Skip to content

Instantly share code, notes, and snippets.

@quilime
quilime / rename_multiple_files.sh
Created January 11, 2010 08:10
rename multiple files in dir
ls | nl -nrz -w2 | while read a b; do mv "$b" filename.$a.png; done;
@quilime
quilime / imageslice.sh
Created January 14, 2010 20:10
split single image into multiple tiles w/imagemagick
#!/bin/bash
#copyright: 2009
#author: gabriel dunne
#url: quilime.com
IMAGE=$1
IMAGE_W=$2
IMAGE_H=$3
ROWS=$4
COLS=$5
@quilime
quilime / time, hostname and current directory
Created April 6, 2010 17:38
Display date/time, hostname and current directory
PS1="[\d \t \u@\h:\w ] $ "
RewriteCond %{REQUEST_URI} ^(.*)//(.*)$
RewriteRule . %1/%2 [R=301,L]
@quilime
quilime / application mod rewrite .htaccess
Created November 29, 2010 07:09
.htaccess for web applications
# 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
quilime / msort.php
Created February 19, 2011 20:26
Simple Multi-Dimensional Key Sort
<?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.
via: http://projects.westhost.com/contest/php/function/simple-multi-dimensional-key-sort/151
@quilime
quilime / stars.py
Created April 18, 2013 03:40
random stars in the console
#!/usr/bin/python
import random
rows = 20
cols = 80
num_stars = 100
rand_stars = []
while (len(rand_stars) < num_stars):
@quilime
quilime / htmlwordcount.py
Last active December 16, 2015 10:58
Count words from html
import nltk
import string
from urllib import urlopen
from itertools import imap
url = "http://google.com"
html = urlopen(url).read()
text = nltk.clean_html(html)
text_noPunc = text.translate(string.maketrans("",""), string.punctuation)
words = text_noPunc.split()
@quilime
quilime / triangle.frag
Last active December 22, 2015 03:09
GLSL Triangle function
// via "Einstienstien" - by Dave Hoskins, on Shadertoy
// http://glsl.heroku.com/e#10662.0
#ifdef GL_ES
precision mediump float;
#endif
uniform vec2 resolution;
float col = 0.0; // Start black.
<!DOCTYPE html>
<meta charset="utf-8">
Hello, world!!!