start new:
tmux
start new with session name:
tmux new -s myname
| #!/usr/bin/env bash | |
| uninstall() { | |
| list=`gem list --no-versions` | |
| for gem in $list; do | |
| gem uninstall $gem -aIx | |
| done | |
| gem list | |
| gem install bundler | |
| } |
| alias speed="wget --output-document=/dev/null http://speedtest.wdc01.softlayer.com/downloads/test500.zip" | |
| alias wanip="curl http://ifconfig.co" | |
| function ipinfo() { curl "http://ipinfo.io/$1"; } |
Fast/efficient approach:
-- execute("UPDATE posts SET comments_count = (SELECT count(1) FROM comments WHERE comments.post_id = posts.id)")
-> 1.3197s
Slow/naïve approach:
ffmpeg -r 24 -pattern_type glob -i '*.JPG' -i DSC_%04d.JPG -s hd1080 -vcodec libx264 timelapse.mp4
-r 24 - output frame rate-pattern_type glob -i '*.JPG' - all JPG files in the current directory-i DSC_%04d.JPG - e.g. DSC_0397.JPG-s hd1080 - 1920x1080 resolution| def rename_collection(old_name, new_name, drop_target=false) | |
| client = Mongoid::Clients.default | |
| current_db = client.database | |
| admin_db = Mongo::Database.new(client, Mongo::Database::ADMIN, current_db.options) | |
| admin_db.command(renameCollection: "#{current_db.name}.#{old_name}", | |
| to: "#{current_db.name}.#{new_name}", | |
| dropTarget: drop_target) | |
| end |
This is a compiled list of falsehoods programmers tend to believe about working with time.
Don't re-invent a date time library yourself. If you think you understand everything about time, you're probably doing it wrong.