Skip to content

Instantly share code, notes, and snippets.

View yuchan's full-sized avatar

Yusuke Ohashi yuchan

View GitHub Profile
#! /usr/bin/env python
import sys
from datetime import datetime
arguments = sys.argv
arg_date = arguments[1]
bd = datetime.strptime(arg_date, "%Y%m%d")
now = datetime.now()
#! /usr/bin/env python
# -*- coding: utf-8 -*-
import urllib
import sys
import os
import subprocess
import re
seed = sys.argv
#! /usr/bin/env python
import sys
args = sys.argv
f = open("test.txt",'r+')
s = args[1]+"\n"
for l in f:
#!/usr/bin/env python
# multiply numbers between 1..30, and answer number of zeros of the tail.
num = 1
count = 0
for i in range(1,31):
num *= i
while num % 10 == 0:
num /= 10
@yuchan
yuchan / syncmaster.sh
Last active August 29, 2015 14:06
Sync master from forked repository.
#! /bin/bash
# http://stackoverflow.com/questions/7244321/how-to-update-github-forked-repository
git fetch upstream
git checkout master
git rebase upstream/master
git push -f origin master
@yuchan
yuchan / array.coffee
Last active August 29, 2015 14:06
Learning CoffeeScript
animals = [
'dog',
'cat',
'elephant']
console.log animals
@yuchan
yuchan / ios8transformsucks.m
Last active August 29, 2015 14:06
iOS8 uiview transformation snippet
// no transforms applied to window in iOS 8
BOOL ignoreOrientation = [[NSProcessInfo processInfo] respondsToSelector:@selector(operatingSystemVersion)];
if(!ignoreOrientation && UIInterfaceOrientationIsLandscape(orientation)) {
//iOS8 landscape
}else if(UIInterfaceOrientationIsLandscape(orientation)) {
//~iOS7 landscape
}else {
// portrate
}
@yuchan
yuchan / GenerateTestCode.py
Last active August 29, 2015 14:07
Generate XCTestCase subclasses from all source classes.
#!/usr/bin/env python
import os
XCTestCaseFormat = """//
// {ClassName}.m
// NrKj_iPhone
//
// Created by {Author} on {Date}.
//
(defun fizzbuzz (n)
(cond
((= (% n 15) 0) "FizzBuzz")
((= (% n 5) 0) "Buzz")
((= (% n 3) 0) "Fizz")
(t n))) ; => fizzbuzz
(fizzbuzz 10) ; => "Buzz"
(fizzbuzz 2) ; => 2
brew list | sed -e 's/^/brew install /g' | awk '{print $1 " " $2 " " $3}' > homebrew.sh