Skip to content

Instantly share code, notes, and snippets.

View animist's full-sized avatar

Rei Kawai animist

  • Uniba Inc.
  • Shibuya
View GitHub Profile
#!/bin/sh
sshfs_cmd='/opt/local/bin/sshfs'
vol_dir='/Volumes/'
#fuse_dirname='fuse_mp'
while getopts p:s:t: OPT
do
case $OPT in
"p" ) port="-p $OPTARG" ;;
@animist
animist / collect_by_date.rb
Created October 27, 2010 09:55
File Collection Program by Date
#!/usr/bin/env ruby
require 'optparse'
# Default parameters
from = Dir.pwd
dry = false
summary = <<EOT
File collection Program by Date
@animist
animist / skelton.rb
Created October 27, 2010 09:54
Ruby cli skelton
#!/usr/bin/env ruby
require 'optparse'
# --- Default parameters ---
a = "example"
summary = <<EOT
Program Description

Hello world

  1. one
  2. two

The quick brown fox jumps over the lazy dog.


``

/*
It's CSS configuration for CodeRay
from this sample
https://github.com/rubychan/coderay/blob/master/lib/coderay/styles/alpha.rb
*/
.CodeRay {
background-color: hsl(0,0%,95%);
border: 1px solid silver;
color: black;
#!/usr/bin/ruby
puts "id,date,name,url,file,status,position,sort_id,pv,top"
count = 1
whole = 1662
while line = gets
if line.match(/href/)
name = line.sub(/.*>(.*)<\/a.*/, "\\1").chomp
@animist
animist / Twitter Stream Sampling
Created June 3, 2013 11:50
Twitter のストリームを取得して垂れ流すサンプル
#!/usr/bin/env ruby
# coding: utf-8
#
# http://d.hatena.ne.jp/shibason/20090816/1250405491
# にあったものを https な 1.1 API に対応させた
require 'net/https'
require 'uri'
require 'rubygems'
require 'json'
@animist
animist / Twitter Stream Sampling to Mroonga
Created June 4, 2013 10:25
Twitter のストリームを取得して Mroonga な DB に突っ込みまくるサンプル
#!/usr/bin/env ruby
# coding: utf-8
require 'net/https'
require 'uri'
require 'rubygems'
require 'json'
require 'pp'
require 'data_mapper'
@animist
animist / unreadable code
Last active December 19, 2015 23:59
アンリーダブルコードできたよー
function fn_old(location_info) {
return "" + !location_info["LocalityName"] ? !location_info["SubAdministrativeAreaName"] ? !location_info["AdministrativeAreaName"] ? "Middle-of-Nowhere" : location_info["AdministrativeAreaName"] : location_info["SubAdministrativeAreaName"] : location_info["LocalityName"] + ", " + !location_info["CountryName"] ? ", Plnanet Earth" : location_info["CountryName"];
}
function fn_new(location_info) {
return (location_info["LocalityName"] || location_info["SubAdministrativeAreaName"] || location_info["AdministrativeAreaName"] || "Middle-of-Nowhere") + ", " + ((location_info["CountryName"] == "USA" ? (location_info["AdministrativeAreaName"] || "USA") : location_info["CountryName"]) || "Planet Earth");
}
@animist
animist / patch.fix.hatena.addbookmark.tbrl.js
Last active November 28, 2018 06:08
patch.fix.hatena.addbookmark.tbrl.js
// ==Taberareloo==
// {
// "name" : "Fix Hatena.addBookmark 2018.11"
// , "description" : "Fix Hatena.addBookmark 2018.11"
// , "include" : ["background"]
// , "version" : "0.0.1"
// , "downloadURL" : "https://gist.githubusercontent.com/animist/d9e11ad8fc2922cde66fd5118141593e/raw/4efa6ad9c6f06e483fc08c9fe97c0674cd0066a1/patch.fix.hatena.addbookmark.tbrl.js"
// }
// ==/Taberareloo==