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 -*- | |
import sys | |
import datetime | |
import time | |
import os | |
from stat import * | |
import commands | |
def watch(dir, command): |
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 subprocess import PIPE, Popen | |
import os | |
import sys | |
def get_current_window_name(): | |
for i in Popen(['xprop', '-root'], stdout=PIPE).stdout: | |
if '_NET_ACTIVE_WINDOW(WINDOW):' in i: | |
for j in Popen(['xprop', '-id', i.split()[4]], stdout=PIPE).stdout: |
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 -*- | |
import sys | |
import os | |
import time | |
import subprocess | |
from threading import Thread | |
import signal |
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
use std::cell::RefCell; | |
use std::rc::Rc; | |
type Link<T> = Rc<RefCell<Node<T>>>; | |
pub struct Node<T: Copy> { | |
value: T, | |
next: Option<Link<T>>, | |
} |
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
WITH RECURSIVE fib (m, n) AS ( | |
SELECT 1, 1 | |
UNION ALL | |
SELECT n, m + n FROM fib | |
) | |
SELECT m FROM fib | |
LIMIT 10 | |
; | |
m | |
---- |
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/bash | |
cd ~ | |
echo "apt-getを使用するためにパスワードを入力" | |
sudo apt-get update | |
sudo apt-get install -y zsh | |
echo "シェルをzshに変更するためにパスワードを入力" | |
chsh -s /bin/zsh | |
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/bash | |
# sudo dd if=~/Downloads/2013-09-25-wheezy-raspbian.img of=/dev/sdb | |
# sudo raspi-config | |
echo -n "What's this ip address?: " | |
read IP_ADDRESS | |
sudo apt-get update | |
sudo apt-get install -y libsqlite3-dev libssl-dev python-pip emacs | |
sudo pip install virtualenv virtualenvwrapper |
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/bash | |
cd ~ | |
echo "apt-getを使用するためにパスワードを入力" | |
sudo apt-get update | |
sudo apt-get install -y zsh | |
echo "シェルをzshに変更するためにパスワードを入力" | |
chsh -s /bin/zsh |
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 |
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 |
NewerOlder