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 | |
TIMESTAMP=`date +'%s'`$(printf '%03d' $(expr `date +%N` / 1000000)) | |
SCREEN_SHOT_NAME=screen_shot_${TIMESTAMP}.png | |
adb shell /system/bin/screencap -p /sdcard/${SCREEN_SHOT_NAME} | |
adb pull /sdcard/${SCREEN_SHOT_NAME} ~/${SCREEN_SHOT_NAME} | |
adb shell rm /sdcard/${SCREEN_SHOT_NAME} |
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 | |
dir='/home/motoki/Documents' | |
file_count=`ls ${dir} | wc -l` | |
random=`od -vAn -N4 -tu4 < /dev/random` | |
rnum=$(( ${random} % $file_count )) | |
count=0 | |
for f in `ls ${dir}`; do | |
if [ "${rnum}" -eq "${count}" ]; then |
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
package ho.ge; | |
/* | |
結果 | |
Main | |
Canonical: ho.ge.Main | |
Name: ho.ge.Main | |
Simple: Main | |
----- | |
Annoymous |
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 | |
CURRENT=`pwd` | |
screen | |
cd ${CURRENT} |
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
#!/usr/bin/env python | |
# -*- coding: utf-8 -*- | |
from urllib import urlopen | |
import json | |
import sys | |
base_url = 'https://api.github.com/users/{username}/gists?page=' | |
def fetch(username): | |
def fetch(page): |
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
angular.module('AngularStudy', []).directive 'ndClick', => ($scope, $element, $attrs) => | |
isTap = isTapped = false | |
$element.bind 'click', => $scope.$apply $attrs['ndClick'] unless isTapped | |
$element.bind 'touchstart', => isTap = true | |
$element.bind 'touchmove', => isTap = false | |
$element.bind 'touchend', => if isTap | |
isTapped = true | |
$scope.$apply $attrs['ndClick'], $element |
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
timestamp() { | |
printf '%ld\n' $(expr `date +%s%N` / 1000000) | |
} |
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
printf '=%.0s' {1..80} |
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 | |
# Copyright (c), Naruse Motoki (motoki@naru.se) | |
# Licensed under The MIT License | |
dryrun=`git push -n 2>&1` | |
echo "$dryrun" | |
fromto=`echo $dryrun | sed -e "s/.* \([0-9a-z]\+\.\.[0-9a-z]\+\) .*/\1/g"` | |
if expr "$fromto" : "^[0-9a-z]\+\.\.[0-9a-z]\+$" >/dev/null; then | |
echo "`git log --date=short --pretty=format:"%h %ad %an %s" $fromto`" | |
fi |
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
#!/usr/bin/env python | |
# -*- coding: utf-8 -*- | |
class _Singleton(type): | |
""" | |
Python 2.xと3.xの両方をサポートするためには、このように継承しなければならない。 | |
class SubClass(_Singleton('Singleton', (object, ), {})): | |
pass |