You want to play a notification sound in a Linux shell script, but don’t want to download any sound files (e.g. MP3, WAV, MIDI). Here is a script that generates the sound on-the-fly:
First install SoX, the Swiss Army knife of sound processing programs.
sudo apt-get install sox
Then:
play -n synth 0.3 pluck A3 vol -20dB repeat 2
play: the player command from SoX.
-n: Play a “null file”.
synth 0.3 pluck A3: Play the A3 (220.00 Hz) sound for 0.3 seconds, with a waveform that simulates a guitar string pluck.
vol -20dB: The default is too loud, reduce the volume by -20dB.
useserde_derive::{Serialize,Deserialize};// Imports the procedural macros#[derive(Serialize,Deserialize)]structFoo;
However, the serde crate re-exports the serde_derive::{Serialize, Deserialize} macros, hidden behind the feature flag derive. So if you enable the derive feature you can get both the Serialize/Deserialize traits and procedural macros (i.e., the custom derive) from the serde crate by one single use:
// Cargo.toml[dependencies]serde={version="1.0",features=["derive"]}// src/main.rs or lib.rsuseserde::{Serialize,Deserialize};// Imports both the traits and procedural macros#[derive(Serialize,Deserialize)]structFoo;
You can choose not to use the derive feature. But you’ll run into this issue if any of your dependencies enables the derive feature. You can either:
Just enable derive (recommended).
Use serde::ser::Serialize and serde::de::Deserialize to get the trait and keep using serde_derive::{Serialize, Deserialize} to get the procedural macros.
Use the AWS provider in us-east-1 region. (Although in the AWS Console it will still be listed under “Global”.)
On aws_cloudfront_distribution:
You can use web_acl_id - aws_wafv2_web_acl.<name>.arn. Be careful that even though the name is id, but you need to pass the ARN instead. This bug only happens in V2.
The IAM user/role you use to execute terraform apply must have the waf:GetWebACL permission.