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 | |
cd ~ | |
echo "apt-getを使用するためにパスワードを入力" | |
sudo apt-get update | |
sudo apt-get install -y zsh | |
echo "シェルをzshに変更するためにパスワードを入力" | |
chsh -s /bin/zsh |
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 -*- | |
class _Singleton(type): | |
""" | |
Python 2.xと3.xの両方をサポートするためには、このように継承しなければならない。 | |
class SubClass(_Singleton('Singleton', (object, ), {})): | |
pass |
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/sh | |
# Copyright (c), Naruse Motoki ([email protected]) | |
# 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 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
printf '=%.0s' {1..80} |
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
timestamp() { | |
printf '%ld\n' $(expr `date +%s%N` / 1000000) | |
} |
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
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 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 -*- | |
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 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/sh | |
CURRENT=`pwd` | |
screen | |
cd ${CURRENT} |
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
package ho.ge; | |
/* | |
結果 | |
Main | |
Canonical: ho.ge.Main | |
Name: ho.ge.Main | |
Simple: Main | |
----- | |
Annoymous |
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/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 |