Skip to content

Instantly share code, notes, and snippets.

View kyl191's full-sized avatar

Kyle Lexmond kyl191

View GitHub Profile
<?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';
}
@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)
{
@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 / 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 / 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 / filenames.py
Created May 12, 2012 17:22
Dropquest 2012 Chapter 1 Counting
for x in [3,4,6]:
if x == 3:
y = 8
z = 4
if x == 4:
y = 6
z = 3
if x == 6:
y = 4
z = 2
@kyl191
kyl191 / triangles.c
Created October 19, 2012 16:07
Triangles - finding angles between lines.
#include <stdio.h>
#include <math.h>
#include <assert.h>
//c99 removed M_PI, so check if it's defined, if not, define it
#ifndef M_PI
#define M_PI acos(-1.0)
#endif
void triangles(double a, double b, double h){
@kyl191
kyl191 / marmoset_submit.sh
Last active October 12, 2015 16:37
Modified version of marmoset_submit to automagically add a tag in git when submitting, and push the tag to github
#!/bin/bash
if [ $# -lt 3 ]; then
echo "Usage: marmoset_submit course project file [...]"
exit 1
fi
if [ $# -eq 3 ]; then
zip "$3" >& /dev/null
if [ $? -eq 12 ]; then
/u8/cs_build/bin/marmoset_submit "$@"
exit 0;
今天我发现你的javascript想一个中文字是一个ASCII字。
所以我现在用中文写比较多的东西。
但是,我没有特别好的东西写。
所以我希望你会以为写中文是一个非常独特的东西。
Translated, it's:
Today I found out your javascript code is thinking one chinese character is equivalent to one standard ASCII character.
So I'm using Chinese to write more than I would otherwise be able to.
Unfortunately, I can't think of anything really interesting to write.
So I'm hoping you will think writing Chinese is a very unique thing.
@kyl191
kyl191 / Q2.asm
Created October 22, 2013 04:13
ECE222 Midterm Practice
MOV r0, #0
LDR r1, =N; N is label in memory, assuming it's +/- 4096
MOV r2, #0; r2 is the counter
LOOP; just a label
MUL r3, r2, r2; i * i
ADD r0, r0, r3; total += i*i
ADD r2, r2, #1; i++
CMP r2, r1; break out of loop when i = N
BNE LOOP