This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"semi": true, | |
"tabWidth": 2, | |
"printWidth": 100, | |
"singleQuote": true, | |
"trailingComma": "all", | |
"jsxBracketSameLine": true | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html> | |
<head> | |
<meta charset=utf-8 /> | |
<title>Draw a line</title> | |
<style> | |
#DemoCanvas { | |
border: 1px solid #ddd; | |
} | |
</style> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import sys | |
import distutils.log | |
import distutils.dir_util | |
import os | |
if len(sys.argv) != 3: | |
print ('Usage : python pysync2.py src dest') | |
exit(1) | |
src, dest = map(os.path.abspath, sys.argv[1:]) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# script to smartly backup files using cp rather than rsync | |
import sys | |
import os | |
import exceptions | |
from pprint import pprint as pp | |
def removeFile(fp): | |
os.remove(fp) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import sys | |
import os | |
import traceback | |
from pprint import pprint as pp | |
import string | |
def cleanupName(s): | |
while ' ' in s: | |
s = s.replace(' ', ' ') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from winreg import * | |
import os | |
def is_admin(): | |
if os.name == 'nt': | |
try: | |
# only windows users with admin privileges can read the C:\windows\temp | |
temp = os.listdir(os.sep.join([os.environ.get('SystemRoot','C:\\windows'),'temp'])) | |
except: | |
return False |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from _winreg import * | |
"""print r"*** Reading from HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Enum\HID ***" """ | |
aReg = ConnectRegistry(None,HKEY_LOCAL_MACHINE) | |
FLIP_FLOP_VALUE = 1 | |
aKey = OpenKey(aReg, r"SYSTEM\CurrentControlSet\Enum\HID") | |
for i in range(1024): |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from pprint import pprint as pp | |
from time import time | |
st = time() | |
def codeForGuess(ch, firsts, indent): | |
ind = ' '*indent | |
v1 = """\ | |
%sfor %s in %s: | |
%s urem(%s)""" % (ind, ch, "udiff(set0)" if ch in firsts else "ucopy()", |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// returns a range as a list | |
function range(start, stop, step) { | |
let result = [] | |
if (step === undefined) { | |
step = 1 | |
} | |
if (stop === undefined) { | |
stop = start | |
start = 0 | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Returns a random number between min (inclusive) and max (exclusive) | |
function rand(min, max) { | |
return Math.random() * (max - min) + min; | |
} | |
// Returns a random integer between min (included) and max (excluded) | |
// Using Math.round() will give you a non-uniform distribution! | |
function randInt(min, max) { | |
return Math.floor(Math.random() * (max - min)) + min; | |
} |
NewerOlder