Skip to content

Instantly share code, notes, and snippets.

Avatar

naaman naaman

  • heroku
  • sf
View GitHub Profile
@naaman
naaman / less_tail.zsh
Created Mar 30, 2015
Tail a Pipe Using Less
View less_tail.zsh
less_tail() {
tmp_file=`mktemp -t lesstail`
$@ > $tmp_file &
less +F $tmp_file
kill %
rm $tmp_file
}
View gist:266dacbf2e762194563c
Process: Heroku Deploy [23663]
Path: /Users/USER/Downloads/Heroku Deploy 2.app/Contents/MacOS/Heroku Deploy
Identifier: com.yourcompany.HerokuDeploy
Version: 1.0 (1.0)
Code Type: X86-64 (Native)
Parent Process: launchd [392]
User ID: 265846391
Date/Time: 2014-07-31 16:07:33.398 -0700
OS Version: Mac OS X 10.8.5 (12F45)
View chunker.rb
#require 'net/http'
require 'excon'
Excon.defaults[:chunk_size] = 1024*10
streamer = lambda do
sleep((100..500).to_a.sample.to_f / 1000)
"#{%w(hello from streaming how do you do).to_a.sample * 30}\n"
end
View chunker.rb
require 'excon'
file = File.open(ARGV[1], 'rb')
streamer = lambda do
file.read(Excon.defaults[:chunk_size]).to_s
end
res = Excon.post(
"http://busl.herokuapp.com/streams/#{ARGV[0]}",
@naaman
naaman / h3.sh
Created Apr 14, 2014
Heroku API v3
View h3.sh
h3 () {
domain=${HEROKU_API_URL:-"https://api.heroku.com"}
curl -n -k -H "Accept: application/vnd.heroku+json; version=3" ${domain}/$@
}
View gist:10492798
get '/api/health/db' do
Data.db_ping
to_json(status: 'ok')
rescue
raise UnavailableException
end
View gist:10194591
Builds::UserEnvCompileEnabledTest user-env-compile enabled
Initializing repository, done.
-----> Fetching custom tar buildpack... done
-----> TEST app detected
USER=u9674
SSH_CLIENT=10.200.57.229 49615 24578
MAIL=/var/mail/u9674
TEST_KEY=TEST_VALUE
View gist:9791852
irb(main):001:0> cc = "\x91"
=> "\x91"
irb(main):002:0> cc.include?(cc)
=> false
View foobarbaz.go
package main
import (
"foo/v3"
v1 "baz/v1"
"baz/v2"
)
func main() {
bourbon.Run(foo.Server, v1.Server, baz.Server)
View gist:9262637
$ curl https://api.heroku.com/apps/naaman-iter/builds -n -k -H 'Accept: application/vnd.heroku+json; version=3' -d '{"source_blob":{"url":"http://github.com/naaman/barebones-jetty/archive/master.tar.gz"}}' -X POST -H 'Content-Type: application/json'
{
"id": "e2ee83c8-7c28-499d-bbe3-9249e2ec7b96",
"status": "started",
"created_at": "2014-02-28 00:19:19 +0000",
"source_blob": {
"url": "http://github.com/naaman/barebones-jetty/archive/master.tar.gz"
}
}%