Skip to content

Instantly share code, notes, and snippets.

View mattn's full-sized avatar
🍛
I love curry 🍛

mattn mattn

🍛
I love curry 🍛
View GitHub Profile
@bellbind
bellbind / getscreenshot.c
Created July 1, 2009 13:33
[c][gtk][webkit]get screenshot PNG from web page
/*
* get screenshot PNG from web page
*
* build:
* FLAGS=`pkg-config --cflags --libs gtk+-x11-2.0 glib-2.0 webkit-1.0`
* gcc -Wall $FLAGS getscreenshot.c -o getscreenshot
*
* usage:
* /usr/bin/xvfb-run -s "-screen 0 1024x768x24" ./getscreenshot test.html
*
@mattn
mattn / ssh-env.bat
Created March 12, 2010 11:20
windowsではssh-askpassが使えないのでsetxで環境変数に設定しちゃうぞバッチファイル
@echo off
if "%1" == "-f" goto doit
if "%1" == "-s" goto session
if not "%SSH_AGENT_PID%" == "" goto end
goto doit
:session
for /f "eol=; tokens=1,2 delims==;" %%1 in ('ssh-agent.exe') do (
if "%%1" == "SSH_AUTH_SOCK" setx SSH_AUTH_SOCK %%2 & set SSH_AUTH_SOCK=%%2
if "%%1" == "SSH_AGENT_PID" setx SSH_AGENT_PID %%2 & set SSH_AGENT_PID=%%2
@mattn
mattn / perlvalidate.vim
Created March 30, 2010 08:37
perlvalidate.vim
function! s:package_name()
let mx = '^\s*package\s\+\([^ ;]\+\)'
for line in getline(1, 5)
if line =~ mx
return substitute(matchstr(line, mx), mx, '\1', '')
endif
endfor
return ""
endfunction
@defunkt
defunkt / clients.md
Created April 18, 2010 14:09
A list of Gist clients.

Gist Clients

Want to create a Gist from your editor, the command line, or the Services menu? Here's how.

Editor Support

package MyFinger;
use Filter::Simple;
FILTER_ONLY
code => sub {
s/(\$[a-zA-Z][a-zA-Z0-9]*\s*)☞/\1->/msxg;
s/([a-zA-Z][a-zA-Z0-9]*\s*)☛/\1=>/msxg;
};
1;
@mattn
mattn / closure-counter.c
Created May 13, 2010 05:02
countup closure in C
// gcc -o closure-counter closure-counter.c -lffi
#include <stddef.h>
#include <string.h>
#include <stdio.h>
#include <stdlib.h>
#include <ffi.h>
int
main(int argc, char **argv) {
ffi_cif cif;
#!perl
# 日本の祝日をGoogleから持ってくるスクリプト
use strict;
use LWP::UserAgent;
use POSIX qw(strftime);
use URI;
use JSON::XS;
use XML::LibXML;
use XML::LibXML::XPathContext;
function! s:make_counter(init)
let ret = {"count": a:init}
function! ret.countup() dict
let self.count = self.count + 1
return self.count
endfunction
return ret
endfunction
unlet! c
↑のStar押してみて!
@cooldaemon
cooldaemon / get_zen_snippets_list.diff
Created July 9, 2010 11:27
neocomplcache + zencoding
*** zencoding.vim.org 2010-07-09 12:07:33.000000000 +0900
--- zencoding.vim 2010-07-09 20:00:47.000000000 +0900
***************
*** 2131,2134 ****
--- 2131,2143 ----
return [[line("'<"), col("'<")], [line("'>"), col("'>")]]
endfunction
+ function g:get_zen_snippets_list(type)
+ let type = a:type