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 | |
# -*- coding: utf-8 -*- | |
import urllib | |
import sys | |
import os | |
import subprocess | |
import re | |
seed = sys.argv |
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 | |
import sys | |
from datetime import datetime | |
arguments = sys.argv | |
arg_date = arguments[1] | |
bd = datetime.strptime(arg_date, "%Y%m%d") | |
now = datetime.now() |
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 | |
#today's coding fragment | |
string="path-to-something:$PATH" | |
if [[ $PATH =~ "path-to-something" ]]; then | |
echo "\$PATH contains it" | |
fi |
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 | |
#Created and tested on Mac OS X only. | |
brew tap phinze/cask | |
brew install brew-cask | |
brew cask install basictex | |
if [[ $PATH =~ "texbin" ]]; then |
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 | |
import sys | |
DEFAULT_INDENT = 4 | |
def main(): | |
argc = len(sys.argv) | |
f = None # File IO |
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 | |
# create 512MB RamDisk | |
# (0.512(GB) * (1024^3)) / 512 | |
rm -rf ~/Library/Caches | |
diskutil erasevolume HFS+ 'RamDisk' `hdiutil attach -nomount ram://1073741` | |
ln -s /Volumes/Ramdisk ~/Library/Caches |
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 | |
def fb(n): | |
dic = {} | |
for num in range(1, n+1): | |
dic[num] = "" | |
for num in range(3, n+1)[::3]: | |
dic[num] += "Fizz" | |
for num in range(5, n+1)[::5]: | |
dic[num] += "Buzz" |
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 | |
# Ubuntu Provisioning Script | |
# basic packages | |
sudo apt-get update | |
sudo apt-get install -y openssh-server git language-pack-ja libssl-dev libsqlite3-dev build-essential nginx python-software-properties memcached | |
# install mysql | |
# warning: change the password 'root' to something else. |
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
// This is pseudo code. | |
size_t size; | |
sysctlbyname("hw.machine", NULL, &size, NULL, 0); | |
char *name = malloc(size); | |
sysctlbyname("hw.machine", name, &size, NULL, 0); | |
NSString *modelIdentifier = [NSString stringWithCString:name encoding:NSUTF8StringEncoding]; | |
free(name); |
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
#include <iostream> | |
using namespace std; | |
int fib(int _n){ | |
if(_n <= 0) | |
return 0; | |
else if(_n == 1) | |
return 1; | |
else if(_n == 2) | |
return 2; |