Skip to content

Instantly share code, notes, and snippets.

sudo apt update
sudo apt upgrade -y
sudo apt install nginx -y
echo 'deb https://download.jitsi.org stable/' | sudo tee /etc/apt/sources.list.d/jitsi-stable.list
wget -qO - https://download.jitsi.org/jitsi-key.gpg.key | sudo apt-key add -
# Ensure support is available for apt repositories served via HTTPS
sudo apt-get install apt-transport-https -y
@tomchambers2
tomchambers2 / gist:012544091e614696092a787c56f379a6
Created April 1, 2019 19:48
trim whitespace from image and reassemble with consistent height
convert original.png +repage -crop 1x -trim -resize 1x256\! +append out.png
@tomchambers2
tomchambers2 / gist:2a20d990923cf36c4de534625bafaac4
Created January 30, 2019 11:23
xargs to move selected files/random files
ls | xargs -t -I in mv in sub
ls | sort -R | tail -1000 | xargs -I in mv in ../selected-people/
@tomchambers2
tomchambers2 / gist:bcee2ab521aee81650bc516060c31ee7
Created January 15, 2019 15:29
image magick create montage
montage -geometry 256x256-32 -tile x1 *.png montage-overlap.png
@tomchambers2
tomchambers2 / gist:bf57529b9d0f3064f1da834c6524f3a6
Last active January 15, 2019 14:55
imagemagick expand to 512
# DONT USE this seems to miss off the last iamge
convert -extent 512x256 *.png
# works, use this for batch operations
mogrify -extent 512x256 *.png
@tomchambers2
tomchambers2 / imagemagick-resize.py
Created January 1, 2019 15:44
imagemagick python resize preserving aspect ratio
import os
import subprocess
path_to_images = '/Users/tomchambers/projects/machine_learning_data/clothed_unclothed/original'
images = os.listdir(path_to_images)
image_paths = [path for path in images if 'jpg' in path]
def escape_url(url):
@tomchambers2
tomchambers2 / imagemagick.sh
Last active March 16, 2019 16:30
imagemagick useful stuff
convert * -geometry 512x256^ -gravity center -crop 512x256+0+0 out.jpg
@tomchambers2
tomchambers2 / pix2pix.sh
Last active January 5, 2019 12:47
commands to run pix2pix on floydhub
# TRAIN
floyd run --gpu --data tomchambers2/datasets/person_background_pair:inputs "python pix2pix.py \
--mode train \
--output_dir model \
--max_epochs 200 \
--input_dir /inputs \
--which_direction AtoB"
# TEST (use to generate new images from input)
floyd run --gpu --data tomchambers2/datasets/eleanor_nude_test_2:inputs --data tomchambers2/projects/pix2pix/11:files "python pix2pix.py \
import os
import subprocess
path_to_images = '/Users/tomchambers/projects/machine_learning_results/monster_results'
images = os.listdir(path_to_images)
image_paths = [path for path in images if 'pdf' in path]
image_packages = [{"name": path.split('.')[0], "pdf_name": path}