Skip to content

Instantly share code, notes, and snippets.

View akiyoshi83's full-sized avatar

akiyoshi akiyoshi83

  • Individual
  • Tokyo
View GitHub Profile
@akiyoshi83
akiyoshi83 / scrape.js
Created May 15, 2014 15:10
CasperJS scraping sample
var system = require('system');
var fs = require('fs');
var args = system.args;
// args is phantomjs api.
// args [3] and later arguments of casperjs
var _args = args.slice(3);
if(_args.length < 2) {
console.log("USAGE: casperjs scrape.js URL");
phantom.exit();
@akiyoshi83
akiyoshi83 / regexp_url.js
Last active August 29, 2015 14:01
何度も似たようなの書いてるのでメモ。
// URL RegureExpression.
var regURL = /(https?:)\/\/([^\/]+)(([^?#]*\/)?([^#?]+)?)(\?[^#?]+)?(#.*)?/;
// if matched returns below
// 0: URL ex) "http://example.com/path/to/index.html?foo=bar#baz"
// 1: Scheme ex) "http:"
// 2: Domain ex) "example.com"
// 3: Path ex) "/path/to/index.html"
// 4: Directory ex) "/path/to/"
// 5: File ex) "index.html"
// 6: Query ex) "?foo=bar"
@akiyoshi83
akiyoshi83 / default.zone
Created May 19, 2014 15:31
tiny dns by twisted
zone = [
SOA(
'example.com',
mname = 'ns1.example.com',
serial = 2014051901,
refresh = '1H',
retry = '1H',
expire = '1H',
minimum = '1H'
),
@akiyoshi83
akiyoshi83 / jquery-marking.js
Last active August 29, 2015 14:02
選択した要素に枠を付けるサンプル
// TODO ラベルの位置
// TODO Windowリサイズ
;(function($) {
function mark($target, options) {
var defaults = {
'border_width': '2px',
'border_color': '#f00',
'class_prefix': 'jqmark',
@akiyoshi83
akiyoshi83 / .tmux.conf
Created July 19, 2014 13:17
tmux.conf 少ない行数でとりあえずそこそこ使い易い設定。
#prefix
set-option -g prefix C-t
#key
bind r source-file ~/.tmux.conf; display-message "tmux conf reloaded."
bind s split-window -v
bind v split-window -h
bind j select-pane -D
bind k select-pane -U
bind h select-pane -L
@akiyoshi83
akiyoshi83 / main.js
Created July 24, 2014 15:37
addon-test01
// require
const self = require("sdk/self");
const data = self.data;
const addonPage = require("sdk/addon-page");
const frameUtils = require('sdk/frame/utils');
const tabs = require("sdk/tabs");
const widget = require('sdk/widget');
const windowUtils = require('sdk/window/utils');
const windows = require("sdk/windows").browserWindows;
@akiyoshi83
akiyoshi83 / LYHGG_chapter01.hs
Last active August 29, 2015 14:06
写経:『すごいHaskellたのしく学ぼう!』
{-
Chapter 1 はじめの第一歩
-}
{-
新しめのGHCiでは:{と}:で囲むことで複数行にわたって式を記述できる。
またGHCi7.2.1以降では:set +mとすることで複数行にわたって式を記述できる。
-}
Prelude> 2 + 15
@akiyoshi83
akiyoshi83 / LYHGG_chapter02.hs
Last active August 29, 2015 14:07
写経:『すごいHaskellたのしく学ぼう!』
{-
Chapter 2 型を信じろ!
-}
{-
2.1 明示的な型宣言
-}
{-
:: という記号は「の型を持つ」と読む。
@akiyoshi83
akiyoshi83 / .vimrc
Created October 16, 2014 07:35
最小限の.vimrc
set nocompatible
set number
set showmode
set ruler
set showcmd
set showmatch
set laststatus=2
set statusline=[%{&fileencoding}][\%{&fileformat}]\ %F%m%r%=<%c:%l>
syntax on
; hello-os
ORG 0x7c00 ; このプログラムがどこに読み込まれるのか
; 以下は標準的なFAT12フォーマットフロッピーディスクのための記述
JMP SHORT entry
DB 0x90
DB "HELLOIPL" ; ブートセクタの名前を自由に書いてよい(8バイト)
DW 512 ; 1セクタの大きさ(512にしなければいけない)
DB 1 ; クラスタの大きさ(1セクタにしなければいけない)