This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
BoldAsFont=no | |
CursorType=block | |
Font=Ricty Diminished | |
FontHeight=14 | |
WindowShortcuts=no | |
Transparency=off | |
FontSmoothing=full | |
Term=xterm-256color | |
Locale=ja_JP | |
Charset=UTF-8 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'spi_mcp' | |
mcp = MCP3208.new | |
val = mcp.channel(0) | |
puts val # 0 ~ 4095 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
TARGET_EXT=readline; cd ~/.rbenv/sources; for x in *; do cd ~/.rbenv/sources/${x}/ruby-${x}; pwd; rm -vf .ext/*/$TARGET_EXT.bundle ext/$TARGET_EXT/Makefile ext/$TARGET_EXT/*.o; make install-ext; done |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/ruby | |
# encoding: UTF-8 | |
if `pbpaste`.match(/“(.*?)”/m) | |
target = $1.chomp | |
require 'open3' | |
puts target | |
Open3.popen3( 'pbcopy' ) {|input, _, _| input << target } | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
extension Int { | |
func fizzbuzz() -> String { | |
switch (self % 3 == 0, self % 5 == 0) { | |
case (true, false): | |
return "Fizz" | |
case (false, true): | |
return "Buzz" | |
case (true, true): | |
return "FizzBuzz" | |
default: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def glitchnize(image_data) | |
bytes = image_data.bytes | |
length = image_data.length | |
d = Pointer.new(:uchar, length) | |
length.times do |i| | |
c = bytes[i] | |
if c == 42 && rand > 0.8 | |
d[i] = rand(255) | |
else | |
d[i] = c |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'formula' | |
class Elasticsearch < Formula | |
homepage 'http://www.elasticsearch.org' | |
url 'https://download.elasticsearch.org/elasticsearch/elasticsearch/elasticsearch-0.90.0.Beta1.tar.gz' | |
sha1 'b2c7381368f8df57d10ce5fa18f55876d5d8969d' | |
head 'https://github.com/elasticsearch/elasticsearch.git' | |
depends_on 'maven' if build.head? |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env ruby | |
require 'msgpack' | |
require 'pp' | |
while gets | |
line = $_.strip | |
begin | |
pp MessagePack.unpack(line) | |
rescue EOFError => e |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env ruby | |
require 'capybara-webkit' # '~> 0.14.0' | |
require 'optparse' | |
require 'cgi' | |
options = {} | |
OptionParser.new do |opt_parser| | |
opt_parser.on('-O filename') {|value| options[:filename] = value } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def destroy_all(conditions = nil) | |
if conditions | |
where(conditions).destroy_all | |
else | |
to_a.each {|object| object.destroy }.tap { reset } | |
end | |
end |