Skip to content

Instantly share code, notes, and snippets.

@melborne
melborne / default_replace.rb
Created February 7, 2010 12:29
Termtter plugins
module Termtter::Client
# search replacement:
# ADD: #[page] arg for list next pages
register_command(
:name => :search, :aliases => [:s],
:exec_proc => lambda {|arg|
search_option = config.search.option.empty? ? {} : config.search.option
arg.gsub!(/\s*#(\d+)$/) { search_option[:page] = $1 ; ''}
if arg.empty? && tags = public_storage[:hashtags]
arg = tags.to_a.join(" ")
↑のStar押してみて!
@zh
zh / em_stream.rb
Created March 18, 2011 03:53
Working with twitter stream (eventmachine)
require 'rubygems'
require 'em-http'
require 'json'
EM.run {
username = 'tw_user'
password = 'tw_password'
buffer = ""
http = EventMachine::HttpRequest.new('http://stream.twitter.com/1/statuses/filter.json').post({
diff --git a/lib/tempfile.rb b/lib/tempfile.rb
index 8bdf086..fbe0e7d 100644
--- a/lib/tempfile.rb
+++ b/lib/tempfile.rb
@@ -194,6 +194,15 @@ class Tempfile < DelegateClass(File)
ObjectSpace.undefine_finalizer(self)
end
+ def mv(destination_path)
+ raise TypeError, "unlinked Tempfile" unless self.path
@fairchild
fairchild / Gemfile
Created December 7, 2011 09:58
An example sinatra omniauth client app
source :rubygems
gem 'sinatra'
gem 'json'
gem 'omniauth'
gem 'omniauth-oauth2'
gem 'omniauth-github'
# gem 'omniauth-att', :path => File.expand_path("./../../omniauth-att", __FILE__)
gem 'thin'
" based on vimclojure/syntax/clojure.vim
"
function! s:paren()
if get(b:, 'rainbowParen', 0) == 1
return
endif
syn match rainbowParenError "]\|}\|)"
syn region rainbowParenLevel0 matchgroup=rainbowParen0 start="(" matchgroup=rainbowParen0 end=")" contains=rainbowParenLevel1
syn region rainbowParenLevel1 matchgroup=rainbowParen1 start="(" matchgroup=rainbowParen1 end=")" contained contains=rainbowParenLevel2
syn region rainbowParenLevel2 matchgroup=rainbowParen2 start="(" matchgroup=rainbowParen2 end=")" contained contains=rainbowParenLevel3
@jugyo
jugyo / aview.rb
Created March 22, 2012 05:04
aview earthquake.gem plugin
# coding: UTF-8
require 'open-uri'
require 'tmpdir'
Earthquake.init do
command :aview do |m|
if m[1] =~ /^http/
url = m[1]
else
@endolith
endolith / LICENSE.txt
Last active January 14, 2024 07:37
Arduino hardware true random number generator
MIT License
Copyright (c) 2012 endolith
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
@matchy256
matchy256 / rec_radiko.sh
Last active October 31, 2023 08:23 — forked from saiten/rec_radiko.sh
簡易Radiko録音スクリプト
#!/bin/bash
LANG=ja_JP.utf8
pid=$$
date=`date '+%Y-%m-%d-%H_%M'`
outdir="."
if [ $# -le 1 ]; then
@colindean
colindean / generate_bitcoin_address.sh
Last active October 12, 2023 23:45
Bitcoin address generator in bash
#!/bin/bash
#
# This is free and unencumbered software released into the public domain.
#
# Requires bc, dc, openssl, xxd
#
# by grondilu from https://bitcointalk.org/index.php?topic=10970.msg156708#msg156708
base58=({1..9} {A..H} {J..N} {P..Z} {a..k} {m..z})
bitcoinregex="^[$(printf "%s" "${base58[@]}")]{34}$"