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
HASH_CHUNK_SIZE = 65536 | |
UINT64_MAX = 2**64 - 1 | |
require 'xmlrpc/client' | |
require 'time' | |
require 'pp' | |
def withOST | |
server = XMLRPC::Client.new_from_uri 'http://api.opensubtitles.org/xml-rpc' | |
login = server.call 'LogIn', '', '', 'en', 'OS Test User Agent' |
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
#!/bin/sh | |
TMP_INDEX="`mktemp .git/tmp_index.XXXXXX`" | |
trap "rm -f \"$TMP_INDEX\"" EXIT | |
rm -f "$TMP_INDEX" | |
GIT_INDEX_FILE="$TMP_INDEX" git add --all | |
TREE_ID=`GIT_INDEX_FILE="$TMP_INDEX" git write-tree` | |
COMMIT_ID=`echo "snapshot"|git commit-tree $TREE_ID` | |
echo $COMMIT_ID |
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
(defn src->gems | |
[src] | |
(with-open [stream (input-stream src)] | |
(->> (ruby) | |
(stream->xs stream) | |
(map rb->gem)))) |
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
/* Outputs gem filenames from spec files. | |
* Full set of public gems: | |
* https://rubygems.org/specs.4.8 | |
* + https://rubygems.org/prerelease_specs.4.8 | |
*/ | |
import org.jruby.Ruby; | |
import org.jruby.RubyArray; | |
import org.jruby.RubyObject; | |
import org.jruby.runtime.marshal.UnmarshalStream; |
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 'json' | |
VERBOSE = (ARGV.include? '-v') | |
rules = JSON::parse(File.read('/etc/oomsaver.json')).collect do |re, score| | |
[Regexp.new(re), score] | |
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
> lein deploy | |
No credentials found for releases | |
See `lein help deploy` for how to configure credentials. | |
Username: pcarrier | |
java.lang.NullPointerException | |
at leiningen.deploy$add_auth_interactively.invoke(deploy.clj:49) | |
at leiningen.deploy$repo_for.invoke(deploy.clj:60) | |
at leiningen.deploy$deploy.invoke(deploy.clj:156) | |
at leiningen.deploy$deploy.invoke(deploy.clj:146) | |
at clojure.lang.Var.invoke(Var.java:415) |
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
# Setup | |
sudo ipvsadm -C | |
sudo ipvsadm -R <<EOF | |
-A -t 169.254.254.1:80 | |
-a -t 169.254.254.1:80 -r 173.194.41.131:80 -m | |
EOF | |
# Add a host | |
sudo ipvsadm -R <<EOF | |
-a -t 169.254.254.1:80 -r 173.194.41.132:80 -m |
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
bash-3.2$ cat foo.json | |
{ | |
"a":"hello world", | |
"b":"bar" | |
} | |
bash-3.2$ eval $(ruby -rshellwords -rjson -e 'JSON::load(STDIN).each {|k,v| puts "export #{Shellwords.shellescape(k)}=#{Shellwords.shellescape(v)}"}' < foo.json) | |
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
#!/bin/sh | |
networksetup -listallnetworkservices | while read s; do sudo networksetup -setsearchdomains "$s" {foo,bar}.example.com; 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
package com.airbnb.tins.api | |
import io.netty.handler.codec.{LengthFieldPrepender, LengthFieldBasedFrameDecoder} | |
import io.netty.channel._ | |
import org.xbill.DNS.{Record, Section, Flags, Message} | |
import java.net.{InetSocketAddress, SocketAddress} | |
import io.netty.handler.logging.{LoggingHandler, LogLevel} | |
import io.netty.handler.codec.bytes.ByteArrayEncoder | |
import io.netty.bootstrap.ServerBootstrap | |
import io.netty.channel.nio.NioEventLoopGroup |