Skip to content

Instantly share code, notes, and snippets.

View luke10x's full-sized avatar

Luke 10X luke10x

View GitHub Profile
@luke10x
luke10x / lcm.py
Created October 17, 2014 18:31
Python oneliners to find lowest common multiplier
#!/usr/bin/env python
print "="*80
#import sys
b = 24
a = 32
for i in range(1, min(a, b)):
if (a % i == 0 and b % i == 0):
gcd = i
#print "Found common divisor" + str(gcd)
@luke10x
luke10x / nginx-wordpress-site
Created July 26, 2014 21:55
Wordpress site with separate directory for app related stuff
server {
server_name tkbodycode.dev;
root /home/lape/workspace/tkbodycode/wordpress;
index index.php;
location / {
try_files $uri $uri/ /index.php;
}
#!/usr/bin/env /usr/bin/python
import os, errno, shutil, sys
from pipes import quote
script_dir = os.path.realpath(os.path.dirname(__file__))
output_dir = script_dir + "/outerr"
tmp_dir = script_dir + "/tmppppppp"
book_dir = os.path.realpath(sys.argv[1])
book_name = os.path.basename(book_dir)
@luke10x
luke10x / monitor-file-changes.py
Created April 16, 2014 22:11
Process that monitors file system changes within directory and runs scripts on changed entities
#!/usr/bin/python
import gamin
import time
from os.path import expanduser
import threading
import thread
import os
import Queue
@luke10x
luke10x / remote2tailable
Created April 16, 2014 21:58
Syncs new lines in a remote log file to a local file then outputs it through tailable
#!/bin/bash
# Syncs new lines in a remote log file to a local file.
# Downloads remote file, and prints all lines that are
# not yet printed
source=$1
# Find the name for the locally copied file
hash=`echo "$source" | md5sum | cut -d " " -f 1`