Skip to content

Instantly share code, notes, and snippets.

View gammy's full-sized avatar

gammy gammy

  • Stockholm
View GitHub Profile
@gammy
gammy / gist:a1bf920b66f8dbd2e52c
Last active August 29, 2015 14:17
advanced_webcam_dumper.bash
#!/bin/bash
while true; do
rm 000*.jpg
mplayer tv:// \
-tv driver=v4l2:device=/dev/video0:width=1280:height=720:outfmt=rgb24 \
-quiet \
-frames 3 \
-vo jpeg 2>&1 | grep frames
last=$(ls -rt *.jpg | tail -n1)
#!/usr/bin/env python3
# Calculate occurrence of letters in two text files,
# and map out the closest relation
# (ie, perform frequency analysis and resolution)
from sys import argv, exit
from os.path import basename
import string
if len(argv) <= 2:
print("Usage: {} <file 1> <file b>".format(basename(argv[0])))
@gammy
gammy / foo.sql
Last active August 29, 2015 14:13
SELECT
s.article_id,
a.category,
DATE(s.date_created) AS date_c,
COUNT(s.article_id) AS count
FROM
warehouse_stockunit AS s,
warehouse_article AS a
WHERE
s.article_id = a.id
https://github.com/gammy/blendserv
See https://github.com/gammy/blendserv
@gammy
gammy / gist:c5de986d1a5acd4b6730
Created December 7, 2014 14:55
Documentaries,
06-12-14:
https://www.youtube.com/watch?v=OGk04igBKhg Archimedes Lost Book
https://www.youtube.com/watch?v=JZYUiQ1xlDk INFINITE SECRETS - NOVA - Discovery History Science (full documentary)
https://www.youtube.com/watch?v=DSsGRfCqN2s Leonardo's Universe
https://www.youtube.com/watch?v=9l2q4g3aZuk The Medici : Secrets of the most Powerful Family in the World (Full Documentary)
https://www.youtube.com/watch?v=peKGD48yqTk Prince John: The Windsors Tragic Secret
https://www.youtube.com/watch?v=8VH5zathu8k The Horrific World of England's Workhouse (Full Documentary)
https://www.youtube.com/watch?v=-zuijePQgCc The Most Prolific Serial Killer In History - Amelia Dyer -The Baby Farm Killer (400+ Victims)
https://www.youtube.com/watch?v=jW8qF3tUDl8 WHAT MAKES US SMART - INTELLIGENCE (Documentary) Science/IQ/Test
@gammy
gammy / secrits.js
Last active August 29, 2015 14:10
var secret = {};
function secret_create(name, phrase, task) {
secret[name] = {
'phrase' : phrase,
'len' : phrase.length,
'array' : new Array(phrase.length),
'active' : false,
'task' : task};
}
@gammy
gammy / foo.py
Created November 24, 2014 19:20
from sportamor.logistics.models import *
from datetime import date, timedelta
max_age = date.today() - timedelta(days=30)
returns = Return.objects.filter(status=ReturnStatuses.PENDING).filter(date_created__gt=max_age)
for r in returns:
o = r.order
invoices = o.invoices.all()
for i in invoices:
#print("Invoice {:d}, pending return {:d} order {:d}: {:s}".format(i.id, r.id, o.id, str(r.date_created)))
#!/usr/bin/bash
steps=20
in=$1
out=$2
tmp=$(mktemp --directory)
echo "> $tmp"
collate=
for i in $(seq 1 $steps); do
Like diz,
scp -r "foo@bar:/store/media/Video/series/Code\ Monkeys/" .