Skip to content

Instantly share code, notes, and snippets.

@fepa
fepa / gist:3ef89b168d444f83989390133d106d4c
Created January 9, 2019 14:01
Upgrade all outdated pip dependencies
pip list --outdated --format=freeze | grep -v '^\-e' | cut -d = -f 1 | xargs -n1 pip install -U
@fepa
fepa / pip_upgrade_everything.sh
Last active June 12, 2018 11:42
Upgrade outdated pip dependencies
pip list --outdated --format=freeze | cut -d= -f1 | xargs pip install -U
@fepa
fepa / extra_webcam
Created October 5, 2017 15:39
Snippet to stream the desktop as a virtual webcam device
#
# source this file to enable a virtual webcam
# that is a stream of the desktop
#
sudo modprobe v4l2loopback exclusive_caps=1
ffmpeg -f x11grab -r 15 -s 360x480 -i :0.0+0,0 -vcodec rawvideo -pix_fmt yuv420p -threads 0 -f v4l2 /dev/video1
@fepa
fepa / Simple pg_restore
Created September 11, 2013 04:35
A snippet to drop in .bashrc to make life easier when restoring PostgreSQL dump files to a database on localhost.
function pglocal {
if [ "$1" = "" ]; then
echo "Run like this:"
echo "pglocal USER DATABASE PATH/TO/FILE"
else
pg_restore --verbose --clean --no-acl --no-owner -h localhost -$
fi
}
1. M-x find-name-dired: you will be prompted for a root directory and a filename pattern.
2. Press t to "toggle mark" for all files found.
3. Press Q for "Query-Replace in Files...": you will be prompted for query/substitution regexps.
4. Proceed as with query-replace-regexp: SPACE to replace and move to next match, n to skip a match, etc.
Source: http://stackoverflow.com/a/271136
@fepa
fepa / gist:2901712
Created June 9, 2012 16:44
Install and symlink dependancies for PIL on Ubuntu 32bit
# Install dependancies
# $ sudo apt-get install libjpeg libjpeg-dev libfreetype6 libfreetype6-dev zlib1g-dev
# Script itself symlinks
ln -s /usr/lib/i386-linux-gnu/libjpeg.so /usr/lib
ln -s /usr/lib/i386-linux-gnu/libfreetype.so /usr/lib
ln -s /usr/lib/i386-linux-gnu/libz.so /usr/lib
# Then install PIL
# pip install -U PIL
@fepa
fepa / gist:2187179
Created March 24, 2012 19:40
A makefile for gecode projects (created this for the ID2204 course at KTH)
# Configure this makefile if needed then run
# $ make all
# to compile and link
# What files to compile
OBJS=money.cpp
# What file to compile to
MAINFILE=money
# What compiler to use
CC=g++