Skip to content

Instantly share code, notes, and snippets.

Avatar

gabriel dunne quilime

View GitHub Profile
@quilime
quilime / rename_multiple_files.sh
Created Jan 11, 2010
rename multiple files in dir
View rename_multiple_files.sh
ls | nl -nrz -w2 | while read a b; do mv "$b" filename.$a.png; done;
@quilime
quilime / imageslice.sh
Created Jan 14, 2010
split single image into multiple tiles w/imagemagick
View imageslice.sh
#!/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 Apr 6, 2010
Display date/time, hostname and current directory
@quilime
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
quilime / msort.php
Created Feb 19, 2011
Simple Multi-Dimensional Key Sort
View msort.php
<?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 Apr 18, 2013
random stars in the console
View stars.py
#!/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 Dec 16, 2015
Count words from html
View htmlwordcount.py
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 Dec 22, 2015
GLSL Triangle function
View triangle.frag
// 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.
View index.html
<!DOCTYPE html>
<meta charset="utf-8">
Hello, world!!!
You can’t perform that action at this time.