Skip to content

Instantly share code, notes, and snippets.

@amitsnyderman
amitsnyderman / flac2mp3.sh
Created July 30, 2019 23:03
Convert flac to mp3 (320k)
find . -name "*.flac" -exec ffmpeg -i {} -ab 320k {}.mp3 \;
@amitsnyderman
amitsnyderman / wav2flac.sh
Last active October 31, 2024 15:47
Convert wav to flac (16-bit / 44.1 kHz)
find . -name "*.wav" -exec ffmpeg -i {} -af aformat=s16:44100 {}.flac \;
@amitsnyderman
amitsnyderman / shrinkray-event.json
Created June 4, 2018 22:17
Example Shrinkray event properties
{
"event_name": "shrinkray_css",
"timestamp": 1528148895106,
"primary_event": false,
"guid": "de5ffb85404.4d2b72dc5d6eeeb4d903.00",
"ip": "73.52.95.215",
"user_agent": "Mozilla/5.0 (iPhone; CPU iPhone OS 11_4 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/11.0 Mobile/15E148 Safari/604.1",
"loc": "https://www.etsy.com/confirm.php?email=beth2124%40aol.com\u0026code=84bbc1b8d533ba0ff9c4560f\u0026action=reset_password\u0026utm_source=transactional\u0026utm_medium=email\u0026utm_campaign=forgot_password_123169_11937570461_0_1\u0026campaign_label=forgot_password\u0026utm_content=\u0026email_sent=1528148852\u0026euid=E8J50vAsPx6USUkvPjgw5THSKZWN\u0026eaid=13585320097\u0026x_eaid=5a17cc9420",
"ref": "https://www.etsy.com/confirm.php?email=beth2124%40aol.com\u0026code=84bbc1b8d533ba0ff9c4560f\u0026action=reset_password\u0026utm_source=transactional\u0026utm_medium=email\u0026utm_campaign=forgot_password_123169_11937570461_0_1\u0026campaign_label=forgot_password\u0026utm
@amitsnyderman
amitsnyderman / mustache-engine.md
Last active May 10, 2018 21:57
Notes for @ksylormiller on Mustache rendering in Etsyweb

About five years ago Etsy added support for Mustache as a template language. Mustache_Engine was chosen as the renderer, but required a bit of customization for our environment:

  • Translation support – Prior to message catalogs, continued support for <msg /> tags was necessary. Rather than re-implement translation support, the implementation uses a two-part render cycle; the first pass leverages the Smarty renderer for only translations, and the second pass renders the language-specific Mustache. An implementation of Mustache_Loader was written for this purpose.
  • Deterministic runtime compilation – Out of the box templates are compiled on demand. To avoid the performance hit in production, templates are built during deploys for all languages and never compiled at runtime. Where and how compilation cache artifacts are persisted are implemented in subclasses of Mustache_Engine.

Manager

The primary interface for rendering Mustache templates.

@amitsnyderman
amitsnyderman / stitcha-ar-workshop-notes.md
Created May 2, 2018 19:15
Stitch AR workshop notes: 20180503
  • “stitcha” name is complementary name to builda
  • Goals
    • Reduce the number of asset requests on a page
    • Question the benefits of reducing the number of asset requests versus reducing the bytes for CSS (removing unused CSS)
  • Traffic might have opinions about what the path is (/ac/)
  • Why Google App Engine?
    • Similar pathway as Photos stack read pathway (GAE, GCP)
    • Has a lot of nice features for deploying
    • However, Security at point had concerns with GAE
  • Caching is at the level of CDN
diff --git a/app.js b/app.js
index 1a60c1d..5dea4f8 100644
--- a/app.js
+++ b/app.js
@@ -16,8 +16,26 @@ module.exports = ({ resolver }) => {
app.use(compress());
app.use(etag());
+ app.use(async (ctx, next) => {
+ try {
@amitsnyderman
amitsnyderman / gist:9354592
Created March 4, 2014 20:08
smarty warning
Warning: json_encode(): recursion detected in /home/auto/workspace/Smarties/lib/lib/Utility/NestedArray.php on line 180
#!/bin/bash
DIR=example
mkdir $DIR
cd $DIR
cat >> Example.scala << EOF
object Main extends App {
println("Hello!")
ssh -L <local-port>:<remote-host>:<remote-port> <user>@<bastion-host>
!!:gs/search/replace/