This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# create environment with jupyter | |
conda create -n ENVNAME python=3 jupyter |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Easy way to remotely access a Jupyter notebook, by forwarding a port | |
# Forward local port 8888 to the remote's localhost port 8888 | |
ssh -L 8888:localhost:8888 user@10.2.2.99 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# resize all files in directory <in> so that the shorter dimension (or both dims) is 64 pixels, then | |
# crop the longer dimension to 64 pixels. | |
magick convert in/* -resize 64x64^ -gravity center -extent 64x64 'out/%06d.jpg' | |
# crop images using find / exec. Find / exec is useful when there are many images and file globs don't work. | |
# Crop to 1150 by 512 at the top, left edge of the image | |
find ./*.jpg -exec magick convert {} -crop 1150x512+0+0 {} \; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# images to video at 10 images per second, 64x64 resolution, named like 000000.jpg | |
# -start_number 12 starts at image 12 | |
# -vframes 100 creates a video with 100 frames | |
# the -pix_fmt option makes it quicktime compatible | |
ffmpeg -y -r 10 -f image2 -s 64x64 -start_number 12 -i %06d.jpg -vframes 100 -pix_fmt yuv420p -vcodec libx264 ./video.mp4 | |
# match image names by file glob | |
ffmpeg -y -r 10 -f image2 -s 1920x1080 -pattern_type glob -i "*.jpg" -pix_fmt yuv420p -vcodec libx264 ../video.mp4 | |
# video to images, image size of 160x128, 10 frames per second, named like 000000.png, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
while true; do rsync -e "ssh -i /PATH/TO/PRIVATE/KEY.pem" -azvh --delete ./LOCAL-REPO/ ec2-user@IP:/REMOTE/PATH; sleep 2; done |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
kill -9 $(ps -ef | grep '[n]ode --debug-brk=5858' | awk '{print $2}') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Uses underscore.js to wrap a function and upon calling | |
// prints the function source and the argument. | |
// Useful for debugging chains of promises. | |
// USAGE | |
// var myfunction = function(argument) {...}; | |
// myfunction = inspect(myfunction); // myfunction is now instrumented | |
var _ = require('underscore'); | |
var util = require('util'); | |
var inspect = function(fnToInspect) { |
NewerOlder