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 thread | |
import time | |
def run(): | |
start=1 | |
while 1: | |
start=start*2 | |
thread.start_new_thread(run,()) | |
thread.start_new_thread(run,()) | |
time.sleep(1000) |
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
shansen@bazinga:~/Documents/dev/looplingo$ ls -hal /proc/22499/fd | |
total 0 | |
dr-x------ 2 shansen shansen 0 2011-12-20 16:27 . | |
dr-xr-xr-x 8 shansen shansen 0 2011-12-20 16:27 .. | |
lrwx------ 1 shansen shansen 64 2011-12-20 16:28 0 -> /dev/pts/0 | |
lrwx------ 1 shansen shansen 64 2011-12-20 16:28 1 -> /dev/pts/0 | |
lrwx------ 1 shansen shansen 64 2011-12-20 16:27 2 -> /dev/pts/0 | |
lr-x------ 1 shansen shansen 64 2011-12-20 16:28 3 -> /home/shansen/VirtualBox VMs/looplingodev/looplingodev.vdi | |
l-wx------ 1 shansen shansen 64 2011-12-20 16:28 4 -> /home/shansen/VirtualBox VMs/looplingodev/looplingodev.vdi.bz2 | |
shansen@bazinga:~/Documents/dev/looplingo$ cat /proc/22499/fdinfo/3 |
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(Word,none) -> | |
{Word,1,none,none}; | |
install(Word,Tree) when Word<element(1,Tree) -> | |
{OtherWord,Count,Left,Right}=Tree, | |
{ | |
OtherWord, | |
Count, | |
install(Word,Left), | |
Right | |
}; |
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
print(none)-> | |
none; | |
print(Tree) -> | |
{Word,Count,Left,Right}=Tree, | |
print(Left), | |
io:fwrite("~s ~B",[Word,Count]), | |
print(Right). |
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
-module(tree). | |
-export([test_with_file/1,install/2,print/1]). | |
test_with_file(Name)-> | |
{ok,Device} = file:open(Name,[read]), | |
test(none,Device). | |
test(Tree,Device) -> | |
case io:get_line(Device,"") of | |
eof -> | |
print(Tree); |
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 inspect | |
frames={} | |
class MyObj: | |
def __init__(self): | |
self.callbacks = [] | |
def __del__(self): | |
print "callbacks" | |
for thing in self.callbacks: | |
try: |
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
;;optional, but awesome way to install packages like flymake and go-mode on emacs24 | |
;;(require 'package) | |
;;(add-to-list 'package-archives | |
;; '("marmalade" . "http://marmalade-repo.org/packages/")) | |
;;M-x list-packages | |
;; install flymake, go mode | |
;; | |
;; To activate syntax checking in buffer: M-x flymake-mode | |
(require 'flymake) | |
(require 'flymake-cursor) |
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 | |
function numerator() { | |
local __resultvar=$1 | |
local fraction=$2 | |
if [[ $fraction =~ (.*)/.* ]] ; then | |
eval $__resultvar="'${BASH_REMATCH[1]}'" | |
fi | |
} | |
function denominator() { |
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 main; | |
import "crypto/tls" | |
import "net" | |
import "fmt" | |
import "bufio" | |
func main() { | |
cert, err := tls.LoadX509KeyPair("/home/shane/.ssh/shared-space-node.crt", | |
"/home/shane/.ssh/shared-space-node.key") | |
config := tls.Config{Certificates: []tls.Certificate{cert}} |
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 sys | |
map = {} | |
while True: | |
line = sys.stdin.read(8) | |
if not line: | |
break | |
map[line] = map.get(line, 0) + 1 | |
for key in map: |
OlderNewer