Skip to content

Instantly share code, notes, and snippets.

@upsilon
upsilon / gist:1165412
Created August 23, 2011 15:22
ブクログとliblarに書籍を同時に登録するbookmarklet
// 改行は自分で削ってね
// 範囲選択とかめんどいからAmazonの商品ページのみ対応
javascript:
var
d=document,
w=window,
e=w.getSelection,
k=d.getSelection,
x=d.selection,
@upsilon
upsilon / gist:1996583
Created March 7, 2012 22:12
@malariya_qma 氏から指摘のあったバグの原因と思はれる箇所の修正差分 #OpenTween
diff --git a/OpenTween/StatusDictionary.cs b/OpenTween/StatusDictionary.cs
index 3c04689..7763f05 100644
--- a/OpenTween/StatusDictionary.cs
+++ b/OpenTween/StatusDictionary.cs
@@ -1193,7 +1193,7 @@ namespace OpenTween
posts = Tab.Posts;
}
- for (int i = StartIdx; i < toIdx; i+= stp)
+ for (int i = StartIdx; i <= toIdx; i+= stp)
@upsilon
upsilon / apikeyTest.php
Created March 29, 2012 03:05
OpenPNE3.8 JSON APIテストケース
<?php
$app = 'api';
include_once dirname(__FILE__) . '/../../bootstrap/unit.php';
include_once dirname(__FILE__) . '/../../bootstrap/database.php';
$configuration = ProjectConfiguration::getApplicationConfiguration('api', 'test', isset($debug) ? $debug : true);
sfContext::createInstance($configuration);
$numOfTest = 4;
@upsilon
upsilon / sfprog.sh
Created June 6, 2012 03:25
演習課題をシェルから放り込みたくなったやっつけスクリプト
#!/bin/sh
# ./sfprog.sh 07
# ./sfprog.sh 07 problem-2012-mid-10-c q10.c
url_base="http://gamma.sf.cs.it-chiba.ac.jp/Class"
class_path="/2012/C-Programming"
#察しろ
user_id=""
@upsilon
upsilon / gist:3302469
Created August 9, 2012 08:56
CS2年前期「プログラミング演習」の課題番号と課題ページの対応が分かりにくい件
@upsilon
upsilon / gist:3337529
Created August 13, 2012 06:53
CREATE TABLEをトランザクション内で実行した比較 (SQLite, MySQL)
upsilon(screen)@udon-dev:~/$ sqlite3 hoge.sqlite
SQLite version 3.7.13 2012-06-11 02:05:22
Enter ".help" for instructions
Enter SQL statements terminated with a ";"
sqlite> begin immediate;
sqlite> create table hoge (id integer, name string, value integer);
sqlite> .schema hoge
CREATE TABLE hoge (id integer, name string, value integer);
sqlite> rollback;
sqlite> .schema hoge
@upsilon
upsilon / test_empty_value.php
Created August 16, 2012 11:20
PHPでGETパラメータとかの空値チェックしたいんだけど何これ
<?php
require_once '/path/to/lime.php';
function test_empty_values($lime, $validator)
{
/* これは空値と見なしたい */
$lime->ok($validator(null), "null");
$lime->ok($validator(''), "''");
$lime->ok($validator(' '), "' '");
@upsilon
upsilon / ksj2osm-admin.pl
Created September 16, 2012 23:05
国土数値情報(行政区域データ) OpenStreetMapインポート用スクリプト
#!/usr/bin/perl
#
# ksj2osm-admin.pl
#
# Modified by upsilon <kim.upsilon@bucyou.net>
#
# Original Author: Tatata (http://wiki.openstreetmap.org/wiki/User:Tatata)
#
# This source based on http://wiki.openstreetmap.org/wiki/User:Tatata/ksj2osm-admin.pl
@upsilon
upsilon / gist:4001734
Created November 2, 2012 14:36
japan.osm.bz2の展開後サイズは何GBになるか?
upsilon(xterm-256color)@upsilo.net:~$ wget -O - http://download.geofabrik.de/openstreetmap/asia/japan.osm.bz2 | bunzip2 - | wc -c
--2012-11-02 23:33:13-- http://download.geofabrik.de/openstreetmap/asia/japan.osm.bz2
Resolving download.geofabrik.de (download.geofabrik.de)... 46.4.99.10, 176.9.53.72
Connecting to download.geofabrik.de (download.geofabrik.de)|46.4.99.10|:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: 1124411982 (1.0G) [application/x-bzip2]
Saving to: ‘STDOUT’
100%[==============================================>] 1,124,411,982 1.36MB/s in 13m 29s
@upsilon
upsilon / gist:4647977
Created January 27, 2013 11:40
PostGISとOsmosisセットアップめも
wget http://bretth.dev.openstreetmap.org/osmosis-build/osmosis-latest.zip
unzip osmosis-latest.zip
chmod +x osmosis-0.41/bin/osmosis
sudo -u postgres
createuser osm
createdb osm
psql -U osm -c 'CREATE EXTENSION hstore'
psql -U osm < /usr/share/postgresql/9.1/contrib/postgis-1.5/postgis.sql
psql -U osm < /usr/share/postgresql/9.1/contrib/postgis-1.5/spatial_ref_sys.sql
psql -U osm < ./osmosis-0.41/script/pgsnapshot_schema_0.6.sql