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 time | |
nums = range(10000) | |
limit_num = 100 | |
def check_1(): | |
stime = time.time() | |
tmp_nums = [] | |
for i in nums: | |
tmp_nums.append(i) |
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
#!/bin/sh | |
# | |
# init.d script with LSB support. | |
# | |
# Copyright (c) 2007 Javier Fernandez-Sanguino <jfs@debian.org> | |
# | |
# This is free software; you may redistribute it and/or modify | |
# it under the terms of the GNU General Public License as | |
# published by the Free Software Foundation; either version 2, | |
# or (at your option) any later version. |
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
# coding: utf-8 | |
import os | |
from fabric.api import prompt,env,abort | |
from fabric.colors import * | |
import ConfigParser | |
class LocalConfigManager(object): | |
CONFIG_FILENAME = ".nobjas_cnf" | |
# TODO: typeがないから今全部str |
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
# coding: utf-8 | |
from fabric.colors import * | |
from config_manager import LocalConfigManager | |
def build_iphone(): | |
local_config = LocalConfigManager() | |
print blue(local_config.get("test_nobjas_project_path")) |
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
#!/bin/sh | |
## https://gist.github.com/noblejasper/8701401 | |
[ -r ~/bin/init_sh.sh ] && . ~/bin/init_sh.sh | |
## FYI http://anchan828.tumblr.com/post/20713455281/unity-mono-mac-windows | |
filepath=`pwd` | |
colorecho "Search "${filepath} blue | |
for f in `find ${filepath} -name '*.cs'` |
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
#!/bin/sh | |
COLOREND="\033[0m" | |
function blackecho() { echo "\033[30m"${1}${COLOREND}; } | |
function redecho() { echo "\033[31m"${1}${COLOREND}; } | |
function greenecho() { echo "\033[32m"${1}${COLOREND}; } | |
function yellowecho() { echo "\033[33m"${1}${COLOREND}; } | |
function blueecho() { echo "\033[34m"${1}${COLOREND}; } | |
function purpleecho() { echo "\033[35m"${1}${COLOREND}; } | |
function cyanecho() { echo "\033[36m"${1}${COLOREND}; } | |
function lgrayecho() { echo "\033[1;30m"${1}${COLOREND}; } |
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
$ sudo pip install PIL |
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
def get_qrcode_path(self): | |
import urllib2, json | |
from StringIO import StringIO | |
base_url = 'http://google.com' | |
api_key = 'hoge' | |
request_url = "https://www.googleapis.com/urlshortener/v1/url?key=" + api_key | |
headers = { | |
'Content-Type' : 'application/json', | |
} | |
values = json.dumps({'longUrl' : base_url}) |
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 boto.dynamodb | |
>>> boto.dynamodb.regions() | |
[RegionInfo:us-east-1, RegionInfo:ap-northeast-1, RegionInfo:eu-west-1] | |
>>> boto.dynamodb.regions()[1] | |
RegionInfo:ap-northeast-1 | |
>>> type(boto.dynamodb.regions()[1]) | |
<class 'boto.regioninfo.RegionInfo'> | |
>>> region_info = boto.dynamodb.regions()[1] | |
>>> conn = region_info.connect(aws_access_key_id='', aws_secret_access_key='') | |
>>> conn |
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
<?php | |
$word = 'そうだ京都へ行こう'. "\n"; | |
$word = strtolower($word); | |
$word = mb_convert_encoding($word, "EUC-jp", "UTF-8"); | |
$descriptorspec = array( | |
0 => array("pipe", "r"), | |
1 => array("pipe", "w"), | |
); |