Skip to content

Instantly share code, notes, and snippets.

View kyl191's full-sized avatar

Kyle Lexmond kyl191

View GitHub Profile
@kyl191
kyl191 / blend.py
Created April 26, 2012 13:47
Image Blender
# Take r, g and b channels from separate images. Python randomises the list for extra fun.
from PIL import Image
import os, math, sys, random
os.chdir(sys.argv[1])
fileList = os.listdir(".")
random.shuffle(fileList)
(width, height) = Image.open(fileList[0]).size
nPhotos = len(fileList)
dst = Image.new("RGB", (width, height))
fileNum = 0
@kyl191
kyl191 / news.php
Created September 4, 2011 03:24
Az
<html>
<head>
<title>Templatefile</title>
<style type="text/css">
body {margin-left: 4%; margin-right: 4%; background-color: #000;}
p {text-indent: 1.5em}
p.c1 {text-align: center}
p.c2 {color: #0D0; font-family: fixedsys, monopoint, terminal}
h1.c1 {color: #0D0; font-family: fixedsys, monopoint, terminal}
h2.mid {margin-top: 3em; margin-bottom:.4em; text-align:center}
@kyl191
kyl191 / colonremover.py
Created August 24, 2011 15:18
Renamer ":" from folder/file names for Windows compatibilty
import os, sys, re, shutil
from os.path import join
os.chdir(sys.argv[1])
# Walk the directory structure looking for folders/files with a ":" in the name
for root, subfolders, files in os.walk('.'):
for foldername in subfolders:
if re.search(":",foldername,re.IGNORECASE):
print "Renaming ", foldername , " -> ", foldername.replace(":","-")
@kyl191
kyl191 / mkdirfile
Created August 13, 2011 07:22 — forked from anonymous/mkdirfile
<?php
function checkName($fname)
{
if ($fname == "20031128ab.jpg")
return "20031128.jpg";
return $fname;
}
function checkPath($pathToImages, $fname)
{
<?php
print dirname(__FILE__).'\n';
function mk($path){
print 'tpath = ' .$path . '\n';
if (!file_exists($path))
if (mkdir($path, 0777))
print 'Success!\n';
else
print 'Fail!\n';
}