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
>>> class Test(object): | |
... a = '' | |
... def __new__(clazz, a): #インスタンス生成 | |
... print 'new' | |
... #__new__はインスタンスではなくクラスを引数に取る(インスタンス生成前だから) | |
... #この__new__が呼び出されたコンテキスト内(clazz)で、Testクラスのスーパークラス呼び出し | |
... return super(Test, clazz).__new__(clazz) #object.__new__(clazz)と同義 | |
... def __init__(self, a): #インスタンス生成後のコンストラクタ | |
... self.a = a | |
... print 'init' |
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
$ curl -kLO https://github.com/utahta/pythonbrew/raw/master/pythonbrew-install | |
$ chmod +x pythonbrew-install | |
$ ./pythonbrew-install | |
$ echo "source ~/.pythonbrew/etc/bashrc" >> .bashrc | |
$ source .bashrc | |
$ pythonbrew install -f 2.6.6 # なぜかtest_ioctlでこけたためforce | |
$ pythonbrew install -f 2.7.2 # 同上 | |
$ pythonbrew install -f 3.2.2 # 同上 |
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
$ curl -kLO http://rvm.beginrescueend.com/releases/rvm-install-latest | |
$ chmod +x rvm-install-latest | |
$ ./rvm-install-latest | |
$ echo "[[ -s "$HOME/.rvm/scripts/rvm" ]] && source "$HOME/.rvm/scripts/rvm"" >> .bashrc | |
$ rvm install 1.8.7 | |
$ rvm install 1.9.2 |
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
using System; | |
using System.Collections.Generic; | |
using System.Text; | |
using NUnit.Framework; | |
namespace TestCodes | |
{ | |
[TestFixture] | |
public class LastIndexTest | |
{ |
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
$ wget http://k.yimg.jp/images/top/sp/logo.gif | |
--2011-03-08 19:34:32-- http://k.yimg.jp/images/top/sp/logo.gif | |
k.yimg.jp をDNSに問いあわせています... 202.93.65.122 | |
k.yimg.jp|202.93.65.122|:80 に接続しています... 接続しました。 | |
HTTP による接続要求を送信しました、応答を待っています... 200 OK | |
長さ: 2077 (2.0K) [image/gif] | |
`logo.gif' に保存中 | |
100%[====================================================================================================================================================================>] 2,077 --.-K/s 時間 0s |
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
;; .emacs | |
;; enable visual feedback on selections | |
(setq transient-mark-mode t) | |
;; default to better frame titles | |
(setq frame-title-format | |
(concat "%b - emacs@" (system-name))) | |
;; default to unified diffs |
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/python | |
# Equivalent of "tail -f" as a webpage using websocket | |
# Usage: webtail.py PORT FILENAME | |
# Tested with tornado 2.1 | |
# Thanks to Thomas Pelletier for it's great introduction to tornado+websocket | |
# http://thomas.pelletier.im/2010/08/websocket-tornado-redis/ | |
import tornado.httpserver |
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 apt-get install zsh zsh-dev | |
$ sudo apt-get install curl | |
$ sudo apt-get install make | |
$ sudo apt-get install gcc | |
$ sudo apt-get install g++ | |
$ sudo apt-get install emacs | |
$ sudo apt-get install emacs-goodies-el | |
$ sudo apt-get install git | |
$ sudo apt-get install subversion | |
$ sudo apt-get install zlib1g |
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
## CentOS-6.2-x86_64-minimal.iso完了後 | |
# shutdown -h now | |
## ネットワーク設定はeth0をNATに、eth1をホストオンリーアダプタにする | |
# cd /etc/sysconfig/network-scripts/ | |
# vi ifcfg-eth0 | |
DEVICE="eth0" | |
BOOTPROTO=dhcp | |
HWADDR="00:00:00:00:00:00" | |
NM_CONTROLLED="yes" | |
ONBOOT="yes" |
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
### install Mesa | |
$ cd | |
$ mkdir lib | |
$ cd lib/ | |
$ wget ftp://ftp.freedesktop.org/pub/mesa/9.0.3/MesaLib-9.0.3.tar.gz | |
$ tar xvzf MesaLib-9.0.3.tar.gz | |
$ cd Mesa-9.0.3/ | |
$ sudo apt-get update | |
$ sudo apt-get install gcc g++ make autoconf wdiff libtool bison flex libxml2 python-libxml2 xutils-dev pkg-config libx11-dev libxext-dev libx11-xcb-dev libxcb-dri2-0-dev libxcb-xfixes0-dev libdrm-dev llvm-dev | |
$ ./configure --enable-xlib-glx --disable-dri |
OlderNewer