Skip to content

Instantly share code, notes, and snippets.

View yyolk's full-sized avatar
๐Ÿฏ
๐™ง๐™š๐™˜๐™ช๐™ง๐™จ๐™ž๐™ซ๐™š ๐™ฉ๐™–๐™ช๐™ฉ๐™ค๐™ก๐™ค๐™œ๐™ฎ

Joseph Chiocchi yyolk

๐Ÿฏ
๐™ง๐™š๐™˜๐™ช๐™ง๐™จ๐™ž๐™ซ๐™š ๐™ฉ๐™–๐™ช๐™ฉ๐™ค๐™ก๐™ค๐™œ๐™ฎ
View GitHub Profile
@yyolk
yyolk / includes_couchdb-proxy
Last active December 21, 2015 15:28
nginx couchdb proxy include
access_log /var/log/nginx/couchdb.access.log;
error_log /var/log/nginx/couchdb.error.log;
location / {
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-NginX-Proxy true;
proxy_pass http://127.0.0.1:5984/;
$.fn.classList = function() {return .attr('class').split(/\s+/);};
@yyolk
yyolk / one-line-for-loop.py
Created August 29, 2013 20:48
replace a for loop in a one-liner
def gen(asset):
# keywords = []
# for keyword in asset.all():
# keywords.append(str(keyword))
# return u'%s' % (", ".join(keywords))
# everything above replaced with below
return u'%s' % ", ".join([str(a) for a in asset.all()])
@yyolk
yyolk / shell.sh
Created August 30, 2013 02:13
save a gist and then open it (Mac)
gist somefile.txt | xargs open
@yyolk
yyolk / -
Created August 30, 2013 04:43
sudo dd if=archlinux-hf-2013-07-22.img bs=1m | pv | sudo dd bs=1m of=/dev/rdisk2
@yyolk
yyolk / howto.md
Last active December 22, 2015 00:08
howto resize partition on alarmpi

#HOWTO deciphered from http://lol.pman.biz/archives/1052

  1. delete old partitions
  2. create new exteneded and then logical partition (2, 5)
  3. reboot
  4. use resize2fs on /dev/mmcblk0p5 your newly resized, and remade, partition

fdisk /dev/mmcblk0

@yyolk
yyolk / import_keywords.py
Last active December 22, 2015 20:59
import keywords
# ./manage.py shell
from museum.models import Keyword
keys = file('keywords.txt', 'r').readlines()
for key in keys:
k = Keyword(keyword=key.strip())
k.save()
print '%s saved as %s' % (key.strip(), k.id)
@yyolk
yyolk / gen_kittens.sh
Last active December 23, 2015 06:49
gen kittens
#generate(grab) 40 different sized placekittenimages
for i in {1..40}; do link="http://placekitten.com/g/`expr $i + 500`/`expr $i + 500`"; echo getting $link ; curl -o out.jpg $link ; done
@yyolk
yyolk / cache_mine.sh
Last active December 25, 2015 00:49
grab all JPEGs, PNGs, and GIFs from Chrome's cache (useful for when someone deletes a post)
#!/bin/sh
CHROME_CACHE=$HOME/Library/Caches/Google/Chrome/Default/Cache
TMP_DIR=$HOME/Downloads/tmp
mkdir -p $TMP_DIR
for i in $(file $CHROME_CACHE/* | egrep -i 'jp|gif|png' |awk '{print $1}' | sed 's/://g'); do cp -v $i $TMP_DIR/`basename $i`.$(file $i | awk '{print tolower($2)}') ; done
@yyolk
yyolk / sendxbmc.sh
Last active December 25, 2015 11:29 — forked from dataolle/sendxbmc.sh
#!/bin/bash
#set url and port to the xbmc box webservice
XBMC_HOST="http://openelec:80"
if [ "$1" = "" ]; then
echo -n "Insert URL: "
read url
else
url="$1"
fi