Skip to content

Instantly share code, notes, and snippets.

%!PS-Adobe-3.0 EPSF-3.0
%%Creator: sora
%%Title: rainbow.eps
%%BoundingBox: 0 0 640 640
%%EndComments
/Radius 200 def
/W 320 def /H 320 def
/cshow { dup stringwidth pop 2 div neg 5 rmoveto show } def
import os, sys, gzip
cnt = 0
wf = open('result.txt', 'a')
for file in sys.argv[1:]:
for line in gzip.open(file, 'rb'):
if cnt % 10000 == 0:
print cnt
o1 = o2 = o3 = o4 = str()
ipaddr, name = line[:-1].split(' ')
o1, o2, o3, o4 = ipaddr.split('.')
import os, sys
cnt = 0
for file in sys.argv[1:]:
for line in open(file, 'r'):
if cnt % 1000 == 0:
print cnt
o1 = o2 = o3 = o4 = str()
ipaddr = line[:-1]
o1, o2, o3, o4 = ipaddr.split('.')
@sora
sora / capitallatlong-20110607.txt
Created June 6, 2011 20:41
Capital cities Lat/Long
# ISO-3166|"capital city"|Lat|Long
AD|"Andorra la Vella"|42.50779|1.52109
AE|"Abu Dhabi"|24.46667|54.36667
AF|"Kabul"|34.52813|69.17233
AG|"St. John's"|47.56494|-52.70931
AI|"The Valley"|18.21704|-63.05783
AL|"Tirana"|41.3275|19.81889
AM|"Yerevan"|40.18111|44.51361
AN|"Willemstad"|12.1084|-68.93354
AO|"Luanda"|-8.8368|13.23317
use strict;
use warnings;
my( %lat, %name, %info, %extra );
open LAT, '<capitallatlong.txt';
open NAME, '<asname-20110606.txt';
open INFO, '<asn-20070110.txt';
open EXT, '<asinfo_20110406.list';
#! /usr/bin/env Python2.6
# coding: utf-8
# by sora
if __name__ == '__main__':
import sys, math
argvs = sys.argv
topodir = "dat/"
peers = open(argvs[1]).readlines()
@sora
sora / init.el
Created June 19, 2011 22:48
emacs
(set-language-environment 'Japanese)
(prefer-coding-system 'utf-8)
(define-key global-map [ns-drag-file] 'ns-find-file)
(global-set-key "\C-h" 'backward-delete-char)
(setq backup-inhibited t)
;(require 'linum)
;(global-linum-mode)
;(setq linum-format "%3d ")
@sora
sora / init.el
Created June 19, 2011 23:21
tex environment
;; tex
(require 'tex-site)
(add-hook 'LaTeX-mode-hook 'TeX-PDF-mode)
(add-hook 'LaTeX-mode-hook 'turn-on-reftex)
(setq reftex-toc-split-windows-horizontally t)
;(setq-default TeX-master nil)
(setq TeX-view-program-selection '((output-pdf "Skim")))
(setq TeX-view-program-list '(("Skim" "/Applications/Skim.app/Contents/SharedSupport/displayline %n %o %b")))
(custom-set-variables
'(LaTeX-command "latex -synctex=1"))
@sora
sora / stack.v
Created February 28, 2012 11:54
stack
`define dbg 1
module stack #(
parameter width = 96, // default item width
parameter depth = 10922, // default stack depth
parameter log2depth = 14 // default stack depth's address range
)(
input CLK,
input RST,
input push,
@sora
sora / slabtbl.v
Created March 4, 2012 15:00
genearete chunk size of each slab class
`include "slabtbl.vh"
module slabtbl (
input CLK,
input RST,
input request,
output reg complate
);
parameter integer maxslabsize = `PAGE_SIZE / `GROW_FACTOR;