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
/** | |
1728 * Code shared by String and StringBuffer to do searches. The | |
1729 * source is the character array being searched, and the target | |
1730 * is the string being searched for. | |
1731 * | |
1732 * @param source the characters being searched. | |
1733 * @param sourceOffset offset of the source string. | |
1734 * @param sourceCount count of the source string. | |
1735 * @param target the characters being searched for. | |
1736 * @param targetOffset offset of the target string. |
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
module Golem::Mongo | |
# Golem::Mongo::ReplSet is an abstraction around a mongo replica set | |
# that provides methods for performing administrative functions. It | |
# implements equivalents to a number of the rs.* helpers in the | |
# mongo shell, as well as higher-level functions for operations such | |
# as managing failovers | |
class ReplSet | |
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 is_in_eventmachine(pid) | |
begin | |
syscall = File.read("/proc/#{pid}/syscall") | |
rescue Errno::ENOENT | |
return false | |
end | |
words = syscall.split(" ") | |
if words.length != 9 | |
# Running, or in an fault handler |
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
# -*- coding: utf-8 -*- | |
class Charge | |
def visit(obj, method, *args) | |
obj.public_send(:"#{method}_for_charge", args) | |
end | |
end | |
class Refund | |
def visit(obj, method, *args) | |
obj.public_send(:"#{method}_for_refund", args) |
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
[nelhage@anarchique:~]$ sudo dpkg-divert --divert /usr/share/update-notifier/notify-reboot-required.orig --rename --add /usr/share/update-notifier/notify-reboot-required | |
Adding 'local diversion of /usr/share/update-notifier/notify-reboot-required to /usr/share/update-notifier/notify-reboot-required.orig' | |
[nelhage@anarchique:~]$ echo $'#!/bin/sh\nexit 0' | sudo tee /usr/share/update-notifier/notify-reboot-required | |
#!/bin/sh | |
exit 0 | |
[nelhage@anarchique:~]$ sudo chmod +x /usr/share/update-notifier/notify-reboot-required | |
[nelhage@anarchique:~]$ sudo rm /var/run/reboot-required* | |
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
class To | |
def initialize(object) | |
@object = object | |
end | |
def method_missing(method, *args) | |
@object.public_send("to_#{method}", *args) | |
end | |
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
package reader | |
import "io" | |
func getRead(r io.Reader) func([]byte) (int, error) { | |
return r.Read | |
} | |
// partial output of `go tool 6g -S read.go`: | |
// |
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
[nelhage@aeronautique:~]$ time ruby -rbson -e1 | |
real 0m0.281s | |
user 0m0.233s | |
sys 0m0.042s | |
[nelhage@aeronautique:~]$ cd /tmp/ | |
[nelhage@aeronautique:/tmp]$ cat > bson.go | |
package main | |
import _ "labix.org/v2/mgo/bson" | |
func main() {} |
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
[A simple Brainfuck quine. This program is not a quine, but if you run | |
it, its output (which will be the same as the input, but stripped of | |
all comments and whitespace) will be. | |
We're going to represent things using four tape cells as one logical | |
struct. Skip right four cells to leave an empty start-of-tape marker.] | |
>>>> |
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
>>>> | |
+++++>>>>+++++>>>>+++++>>>>+++++>>>>++>>>>+++++>>>>+++++>>>>+++++>>>>+++++>>>>+++>>>>+>>>>+>>>>+>>>>+>>>>+>>>>+>>>>+>>>>+>>>>+>>>>+>>>>+>>>>+>>>>+>>>>+>>>>+>>>>+>>>>+>>>>+>>>>+>>>>+>>>>+>>>>+>>>>+>>>>+>>>>+>>>>+>>>>+>>>>+>>>>+>>>>+>>>>+>>>>+>>>>+>>>>+>>>>+>>>>+>>>>+>>>>+>>>>+>>>>+>>>>+>>>>+>>>>+>>>>+>>>>+>>>>+>>>>+>>>>+>>>>+>>>>+>>>>+>>>>+>>>>+>>>>+>>>>+>>>>+>>>>+>>>>+>>>>+>>>>+>>>>+>>>>+>>>>+++++++>>>>+++++++>>>>+++++++>>>>+++++++>>>>++>>>>++++>>>>+++>>>>++>>>>+++++++>>>>+++++++>>>>+++++++>>>>+++>>>>++++++>>>>++++++>>>>++++++>>>>++++++>>>>++>>>>++++++>>>>++++++>>>>+>>>>+>>>>+>>>>+>>>>+>>>>+>>>>++>>>>+++++>>>>+>>>>+>>>>+>>>>+>>>>+>>>>+>>>>+>>>>++++++>>>>++++>>>>+++>>>>+++++>>>>+>>>>+++++>>>>++>>>>++++++>>>>+++++++>>>>++++++>>>>++++++>>>>+>>>>+++++>>>>+++++>>>>+++++>>>>++++>>>>+++>>>>++++++>>>>+>>>>+>>>>+>>>>+>>>>+>>>>+>>>>+>>>>+>>>>+>>>>+>>>>+>>>>+>>>>+>>>>+>>>>+>>>>+>>>>+>>>>+>>>>+>>>>+++++++>>>>+++++++>>>>+++++++>>>>+++++++>>>>+++++>>>>+>>>>+>>>>+>>>>+>>>>++>>>>++++>>>>++++++>>>>++++>>>>++++>>>>++++>> |
OlderNewer