ffmpeg -i /tmp/Mémo-1.m4a -ar 8000 -ac 1 -acodec pcm_u8 message_accueil.wav
flash player compatible video
ffmpeg -i input.avi -vcodec libx264 -vpre hq -b 5000k test.mp4
move ATOM MOOV with qt-faststart:
qt-faststart test.mp4 skippableTest.mp4
reduce video size
encode to h264 removing subtitles and keeping only second audio track:
ffmpeg -i input.mkv -map 0:0 -map 0:2 -sn -acodec ac3 -vcodec libx264 -preset slow -crf 23 output.mkv
testing javascript file with node
test.js
fs = require("fs"); vm = require("vm"); exports.run = function(options){ console.log("-- Testing " + (options.file || "on empty context") + " --"); var script = options.file && load_script(options.file); for(test_name in options.tests){ process.stdout.write(test_name + ": "); run_test(script, options.tests[test_name], options.setup, options.teardown); console.log("OK"); } }; function load_script(path){ var content = fs.readFileSync(path, "utf8"); return vm.createScript(content, path); } function run_test(script, test, setup, teardown){ var context = {}; if(setup){ setup(context); } if(script){ script.runInNewContext(context); } test(context); if(teardown){ teardown(context); } }
Available options:
file: a path to a js file that should be used as tests context.
tests: an array or object of test functions to execute.
setup: a function to execute before running each test.
teardown: a function to execute after running each test.
Exemple usage testing function ‘hello’ in source file foo.js :
foo.js
function hello(name){ return "Hello " + name; }
test_foo.js
#!/usr/bin/env node assert = require("assert"); test = require("./test"); test.run({ file: "foo.js", tests: { "hello greets correctly": function(context){ assert.equal("Hello world", context.hello("world")); } } });
ngrep
Watch web traffic between a client and a server:
ngrep '^(GET|POST)' 'src 10.33.2.49 and dst host prod-1013-ihmrecap.dix94.cvf and tcp and dst port 80'
Cannelés bordelais
Pour 10 cannelés
Ingrédients :
– 25 cl de lait
– 70 gr de farine
– 30 gr de beurre fondu
– 1 sachet de sucre vanillé
– 110 gr de sucre
– 2 œufs soit 1 œuf entier + 1 jaune
– 3 cuillères à soupe de rhum
– 1 cuillère à café d’extrait de vanille.
Faire bouillir dans une casserole le lait, le sucre vanillé, l’extrait de vanille, le rhum et le beurre.
Dans un saladier, mélanger l’œuf entier et le jaune. Bien fouetter.
Mélanger ensuite la farine et le sucre.
Ajouter aux œufs battus.
Bien battre la préparation.
Incorporer ensuite le mélange lait/beurre chaud et bien délayer le tout.
L’idéal est de laisser reposer cette pâte 24 heures au réfrigérateur.
Bien mélanger.
Préchauffer le four à 250°C.
Remplir les moules au 3/4.
Cuisson en 2 temps : 10 mn à 250°C. Ensuite : 50 mn à 180°C.
mysqldump table
mysqldump -usuper -psuper --compact --no-create-info --no-create-db --where "timeId<1010010000" dimension time
Only inserts:
mysqldump -uroot -proot --no-create-info --complete-insert --add-locks=false --skip-comments --complete-insert --skip-triggers --skip-disable-keys --default-character-set=latin1 --skip-set-charset --skip-tz-utc --skip-extended-insert gvw
Scite configuration
# UTF8 code.page=65001 # monospace font font.base=$(font.monospace) font.small=$(font.monospace) font.comment=$(font.monospace) font.text=$(font.monospace) font.text.comment=$(font.monospace) font.embedded.base=$(font.monospace) font.embedded.comment=$(font.monospace) font.vbs=$(font.monospace) # window position position.left=5 position.top=0 position.width=600 position.height=800 # system icons toolbar.usestockicons=1 check.if.already.open=1 # line numbers line.margin.visible=1 line.margin.width=2+ # use spaces as indentation use.tabs=0 tabsize=4 indent.size=4 tab.indents=1 backspace.unindents=1 # cursor and search selection selection.alpha=100 selection.back=#00FF00 autocompleteword.automatic=1 save.recent=1 # open fil filters open.filter= $(all.files) All Source|$(source.files)| $(filter.conf) $(filter.bash) $(filter.cpp) $(filter.css) $(filter.java) $(filter.js) $(filter.perl) $(filter.php) $(filter.properties) $(filter.python) $(filter.ruby) $(filter.sql) $(filter.tex) $(filter.text) $(filter.web) $(filter.yaml)
Pâte à beignets
– 4 cuillères de farine
– Pincée de sel
– Pincée de levure chimique
– Ajouter doucement de l’eau jusqu’à consistance souhaitée
– Baigner dans l’huile assez chaude puis baisser sur 4/5
Recursive find and replace
Add a space after each comma (when there is not already one) for every python files in current directory and subdirectories:
find -type f -name "*.py" -exec sed -i -r 's/,([^ ])/, 1/g' {} ;
sed:
-i edit files in place
-r use extended regular expressions