Skip to content

Instantly share code, notes, and snippets.

@ynkdir
ynkdir / nicodownload.js
Created January 17, 2011 09:13
ニコニコ動画ダウンロードブックマークレット
(function(){
var http_get = function(url) {
var async = false;
var req = new XMLHttpRequest();
req.open("GET", url, async);
req.withCredentials = true;
req.send();
return req.responseText;
};
@ynkdir
ynkdir / rand_msvc.vim
Created January 17, 2011 12:41
msvcrt rand()
" Visual C++ 2010: rand.c
let s:RAND_MAX = 32767
let s:seed = 0
function! Srand(seed)
let s:seed = a:seed
endfunction
@ynkdir
ynkdir / rand_glibc.vim
Created January 17, 2011 12:42
glibc rand()
" glibc-2.12.1: random_r.c
let s:RAND_MAX = 2147483647
function! Srand(seed)
call s:srandom_r(a:seed, s:state)
endfunction
function! Rand()
return s:random_r(s:state)
@ynkdir
ynkdir / rand_v8.vim
Created January 22, 2011 22:08
v8 Math.random()
" v8 r6432: v8.cc
" Random number generator using George Marsaglia's MWC algorithm.
function! Srand(seed)
return s:rand(a:seed)
endfunction
function! Rand()
return s:rand()
endfunction
@ynkdir
ynkdir / zip.js
Created February 4, 2011 11:33
zip.js
// WSH
function zip(zipfile, files) {
var fso = new ActiveXObject("Scripting.FileSystemObject");
var shell = new ActiveXObject("Shell.Application");
var process_id = get_process_id();
// create empty zip (right click -> new file -> compressed (zipped) folder)
var zip = fso.CreateTextFile(zipfile, true);
@ynkdir
ynkdir / sites-build.vim
Created February 13, 2011 03:58
sites-build.vim
#!gvim -u
if has('vim_starting')
set nocompatible
set loadplugins
call feedkeys(":source " . expand('<sfile>:t') . "\<CR>")
finish
endif
set nocompatible
@ynkdir
ynkdir / sites-upload.py
Created February 13, 2011 04:01
sites-upload.py
# encoding: utf-8
# require: http://code.google.com/p/gdata-python-client/
from __future__ import print_function, division, unicode_literals, \
absolute_import
import sys
import os
import codecs
import getpass
@ynkdir
ynkdir / vim-paint-screen-test.vim
Created February 18, 2011 15:14
vim-paint-screen-test.vim
#!gvim -u
set nocompatible
if has('vim_starting')
set loadplugins
call feedkeys(":source " . expand('<sfile>:t') . "\<CR>")
finish
endif
@ynkdir
ynkdir / webthumbnail.py
Created February 19, 2011 09:53
webthumbnail.py
# Webpage thumbnailer
# encoding: utf-8
from __future__ import print_function, division, unicode_literals, \
absolute_import
import sys
import argparse
from PySide.QtCore import Signal, Qt, QObject
@ynkdir
ynkdir / pango-font-metrics-test.c
Created March 1, 2011 12:46
pango-font-metrics-test.c
/*
* $ cc `pkg-config pangocairo --cflags --libs` pango-font-metrics-test.c
*
* $ LC_ALL=C ./a.out
* lang=default ascent=13.000000 descent=4.000000
* lang=C ascent=13.000000 descent=4.000000
* lang=ja-jp ascent=13.000000 descent=4.000000
*
* $ LC_ALL=en_US.UTF-8 ./a.out
* lang=default ascent=13.000000 descent=4.000000