This file contains hidden or 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
| destroy_instance.rb: | |
| #!/usr/bin/env ruby | |
| EventBusWorker.new do |e| | |
| msg = e.publish 'destroy_instance', {:id => ARGV[1]} | |
| e.wait_for 'aws_destroyed', {:req => msg} | |
| e.wait_for 'scout_removed', {:req => msg} | |
| end | |
| aws_destroyed.rb: |
This file contains hidden or 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
| > class A | |
| * def a | |
| * "foo" | |
| * end | |
| * def bind | |
| * binding | |
| * end | |
| * def run | |
| * yield bind | |
| * end |
This file contains hidden or 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 'benchmark' | |
| short_array = [1, 2, 3, 4, 1, 2, 5, 6] | |
| long_array = ([1] * 1000) + short_array | |
| short_match = [1, 2, 5] | |
| long_match = short_match * 10 | |
| class Array | |
| def find_sub_1(match) | |
| (each_cons(match.size).with_index.find {|x, i| x == match } || []).last |
This file contains hidden or 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 find_first a, b | |
| 0.upto(a.length-b.length) do |i| | |
| catch :fail do | |
| 0.upto(b.length-1) do |j| | |
| throw :fail unless a[i+j] == b[j] | |
| end | |
| return i | |
| end | |
| end | |
| nil |
This file contains hidden or 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
| 0.000206443 Assembly | |
| 0.000210307 C (musl, static) | |
| 0.000210635 C (diet, static) | |
| 0.000270350 C (musl, dynamic) | |
| 0.000273091 C (static) | |
| 0.000317843 Fortran (static) | |
| 0.000352856 BusyBox shell | |
| 0.000432001 C (dynamic) | |
| 0.000550067 dash | |
| 0.000594262 MLton |
This file contains hidden or 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
| {"foo": [ | |
| {"bar": "-4"}, | |
| {"bar": "::1"} | |
| ]} |
This file contains hidden or 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
| package main | |
| import ( | |
| "flag" | |
| "log" | |
| "os" | |
| "path" | |
| ) | |
| var src = flag.String("src", "/usr", "source path") |
This file contains hidden or 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
| Section "InputClass" | |
| Identifier "touchpad catchall" | |
| MatchIsTouchpad "on" | |
| Driver "synaptics" | |
| Option "PalmDetect" "on" | |
| EndSection |
This file contains hidden or 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
| Q: Does this Linux ISO support booting off a USB pendrive on a Mac EFI? | |
| (I don't want no BIOS jail, that shit drove me insane about 8 hours ago and I'm out of coffee now) | |
| A: Simple! Yes if it starts with ER. No if it doesn't start with ER. | |
| Examples: | |
| % (dd bs=8 count=1 2>/dev/null|xxd) < Fedora-17-x86_64-Live-Desktop.iso | |
| 0000000: 4552 0800 0000 9090 ER...... | |
| ===> That's a yes. |
This file contains hidden or 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
| Trying to be "idiomatic" yet fair. Used JD GUI to show the bytecode in human-readable Java. | |
| Somehow mirah breaks JD GUI, which is probably interesting. | |
| So I went through an intermediate Java file thanks to mirah -j instead. |