This file contains hidden or 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
# input formatting | |
class FileWrapper: | |
def __init__(self, file): | |
self.file = file | |
def getInt(self): | |
return int(self.file.readline()) | |
def getInts(self): | |
return [int(z) for z in self.file.readline().split()] |
This file contains hidden or 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
# generic currying decorator | |
# right currying behavior | |
from functools import partial | |
""" | |
Curry decorator | |
""" | |
def curry(func, args_num=1, args_total=None): | |
if not args_total: args_total = func.func_code.co_argcount | |
def curried(arg1): |
This file contains hidden or 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
#!/usr/bin/env python | |
""" | |
Functional feature testing in Python 2/3 | |
""" | |
# Imperative | |
INPUT = "1+2++3+++4++5+6+7++8+9++10" | |
result = 0 | |
for num in INPUT.split('+'): |
This file contains hidden or 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 functools | |
def curry(func): | |
def curried(*args, **kwargs): | |
if not args and not kwargs: | |
return func() | |
return curry(functools.partial(func, *args, **kwargs)) | |
return curried | |
@curry | |
def add(a, b, c, d, e, f, g): |
This file contains hidden or 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
data = [60, 1, 12, 26, 9, 12, 3, 8, 24, 17, 8, 4, 6, 23, 21, 6, 4, 6, 22, 12, 5, 6, 5, 4, 6, 21, 11, 8, 6, 4, 4, 6, 21, 10, 10, 5, 4, 4, 6, 21, 9, 11, 5, 4, 4, 6, 21, 8, 11, 6, 4, 4, 6, 21, 7, 11, 7, 4, 4, 6, 21, 6, 11, 8, 4, 4, 6, 19, 1, 1, 5, 11, 9, 4, 4, 6, 19, 1, 1, 5, 10, 10, 4, 4, 6, 18, 2, 1, 6, 8, 11, 4, 4, 6, 17, 3, 1, 7, 5, 13, 4, 4, 6, 15, 5, 2, 23, 5, 1, 29, 5, 17, 8, 1, 29, 9, 9, 12, 1, 13, 5, 40, 1, 1, 13, 5, 40, 1, 4, 6, 13, 3, 10, 6, 12, 5, 1, 5, 6, 11, 3, 11, 6, 14, 3, 1, 5, 6, 11, 3, 11, 6, 15, 2, 1, 6, 6, 9, 3, 12, 6, 16, 1, 1, 6, 6, 9, 3, 12, 6, 7, 1, 10, 7, 6, 7, 3, 13, 6, 6, 2, 10, 7, 6, 7, 3, 13, 14, 10, 8, 6, 5, 3, 14, 6, 6, 2, 10, 8, 6, 5, 3, 14, 6, 7, 1, 10, 9, 6, 3, 3, 15, 6, 16, 1, 1, 9, 6, 3, 3, 15, 6, 15, 2, 1, 10, 6, 1, 3, 16, 6, 14, 3, 1, 10, 10, 16, 6, 12, 5, 1, 11, 8, 13, 27, 1, 11, 8, 13, 27, 1, 60] | |
import sys | |
toggle = lambda x: int(not bool(x)) | |
def word_gen(): | |
word = 'ELOV' | |
while 1: | |
new_word = word[1:] + word[0] | |
word = new_word |
This file contains hidden or 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
var projectId = ScriptProperties.getProperty("projectId"); | |
function プロジェクトの取得() { | |
var list = BigQuery.Projects.list(); | |
Logger.log(list); | |
} |
This file contains hidden or 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
#!/bin/bash | |
PATTERN=http://commondatastorage.googleapis.com/migo_10_11_logs%2Fmigo-20131001-output.gz.csv | |
function truncate_gs_path () { | |
local all_path=$1 | |
local allfile_raw_path=${all_path//gs:\/\//} | |
echo ${allfile_raw_path//\//%2F} | |
} | |
function all_files () { |
This file contains hidden or 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
function DateFmt(fstr) { | |
this.formatString = fstr | |
var mthNames = ["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"]; | |
var dayNames = ["Sun","Mon","Tue","Wed","Thu","Fri","Sat"]; | |
var zeroPad = function(number) { | |
return ("0"+number).substr(-2,2); | |
} | |
var dateMarkers = { |
This file contains hidden or 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
@ECHO OFF | |
ECHO "Fixing clipboard..." | |
"C:\Program Files\VMware\VMware Tools\vmtoolsd.exe" –n vmusr | |
ECHO "done, press any key to exit..." | |
PAUSE |
This file contains hidden or 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
body { | |
font-family: "Open Sans"; | |
font-weight: light; | |
} |