Skip to content

Instantly share code, notes, and snippets.

@f440
f440 / pinboard_to_elasticsearch.rb
Created February 16, 2014 10:34
Import to ElasticSearch from Pinboard
#!/usr/bin/env ruby
require 'rexml/document'
require 'elasticsearch'
doc = REXML::Document.new(open(ARGV[0]).read)
es = Elasticsearch::Client.new log: true
doc.elements.each('/posts/post') do |element|
# attributes: [href, time, description, extended, tag, hash, shared]
@f440
f440 / zaw.rb
Last active August 29, 2015 13:57
brew install ./zaw.rb --HEAD
require 'formula'
class Zaw < Formula
homepage 'https://github.com/zsh-users/zaw'
head 'https://github.com/zsh-users/zaw.git'
def install
(share/'zaw').install Dir['*']
end
@f440
f440 / delicious2pinboard.rb
Created March 30, 2014 11:41
Import from delicious to pinboard
#!/usr/bin/env ruby
require 'nokogiri'
require 'date'
require 'faraday'
html = Nokogiri::HTML(open("delicious.html"))
posts = []
html.xpath("//dd | //dt").each do |element|
@f440
f440 / zsh-autosuggestions.rb
Created April 30, 2014 01:59
brew install ./zsh-autosuggestions.rb --HEAD
require 'formula'
class ZshAutosuggestions < Formula
homepage 'https://github.com/tarruda/zsh-autosuggestions'
head 'https://github.com/tarruda/zsh-autosuggestions.git'
def install
(share/'zsh-autosuggestions').install Dir['*']
end
@f440
f440 / curl.log
Last active August 29, 2015 14:06
HTTP 1.0 で画像にアクセス # curl --verbose --http1.0 https://pbs.twimg.com/media/B.....
* Adding handle: conn: 0x7fdc20804000
* Adding handle: send: 0
* Adding handle: recv: 0
* Curl_addHandleToPipeline: length: 1
* - Conn 0 (0x7fdc20804000) send_pipe: 1, recv_pipe: 0
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
0 0 0 0 0 0 0 0 --:--:-- --:--:-- --:--:-- 0* About to connect() to pbs.twimg.com port 443 (#0)
* Trying 117.18.237.139...
@f440
f440 / redis_watch.rb
Last active August 29, 2015 14:07
redis-rb で watch
require 'redis'
require 'hiredis'
# usage:
# 端末(1) : 更新し続ける
# watch -n 0.1 "echo incr r | redis-cli"
# 端末(2) : watch しつつ更新する
# ruby redis_watch.rb 1000000
r = Redis.new(driver: :hiredis, timeout: 60) # デフォルトだと、5秒でタイムアウト
@f440
f440 / .gitignore
Created June 23, 2015 14:48
Terraform Template
terraform.tfstate*

Keybase proof

I hereby claim:

  • I am f440 on github.
  • I am f440 (https://keybase.io/f440) on keybase.
  • I have a public key whose fingerprint is 4092 7D7D F720 F29F 312D 7FEA 951C 83FA 73A9 9D00

To claim this, I am signing this object:

@f440
f440 / my_template.rb
Created December 15, 2010 04:22
rials template
#
# This work is in the public domain.
#
if yes? "Do you use haml? [yes/no]"
gem 'haml-rails'
end
if yes? "Do you use compass? [yes/no]"
gem 'compass'
#!/usr/bin/env ruby
#-*- coding: utf-8 -*-
#
# unify dupulicated gem files.
#
# This work is in the public domain.
#
require 'digest/md5'