Skip to content

Instantly share code, notes, and snippets.

quilime /
Created Jan 11, 2010
rename multiple files in dir
ls | nl -nrz -w2 | while read a b; do mv "$b" filename.$a.png; done;
quilime /
Created Jan 14, 2010
split single image into multiple tiles w/imagemagick
#copyright: 2009
#author: gabriel dunne
quilime / time, hostname and current directory
Created Apr 6, 2010
Display date/time, hostname and current directory
quilime / application mod rewrite .htaccess
Created Nov 29, 2010
.htaccess for web applications
View application mod rewrite .htaccess
# Pass existing files, symlinks, directories through like normal
RewriteCond %{REQUEST_FILENAME} -f [OR]
RewriteCond %{REQUEST_FILENAME} -l [OR]
RewriteCond %{REQUEST_FILENAME} -d
RewriteRule ^.*$ - [NC,L]
# Pass everything else to the application
RewriteRule ^.*$ application.php [NC,L]
quilime / msort.php
Created Feb 19, 2011
Simple Multi-Dimensional Key Sort
View msort.php
A simple multidimensional key-value sorting function, allowing you to sort an
array by a multidimensional key without having to write callback functions.
This concept appears to be missing in PHP, this function allows for easy array
sorting. Works with both strings and numbers, case sensitive and doesn't
drop/mash keys. PHP 5.3.0 > only.
quilime /
Created Apr 18, 2013
random stars in the console
import random
rows = 20
cols = 80
num_stars = 100
rand_stars = []
while (len(rand_stars) < num_stars):
quilime /
Last active Dec 16, 2015
Count words from html
import nltk
import string
from urllib import urlopen
from itertools import imap
url = ""
html = urlopen(url).read()
text = nltk.clean_html(html)
text_noPunc = text.translate(string.maketrans("",""), string.punctuation)
words = text_noPunc.split()
quilime / triangle.frag
Last active Dec 22, 2015
GLSL Triangle function
View triangle.frag
// via "Einstienstien" - by Dave Hoskins, on Shadertoy
#ifdef GL_ES
precision mediump float;
uniform vec2 resolution;
float col = 0.0; // Start black.
View index.html
<!DOCTYPE html>
<meta charset="utf-8">
Hello, world!!!