View s3-buffer.sh
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 | |
#file_count=100 | |
#source_bucket="example-log-stream" | |
#buffer_bucket="example-log-stream-buffer" | |
# Move $file_count files from an s3 bucket to a second buffer bucket, if the buffer | |
# bucket contains fewer than $file_count objects. | |
# | |
# We use this to prevent a logstash s3 input filter blowing up our ELK server when backlog of | |
# files builds up in s3 (e.g traffic spikes, or after period of system downtime.) |
View subl.bash
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
function subl { | |
if [ -n "$1" ]; then | |
command subl $1 | |
elif [ -f *.sublime-project ]; then | |
command subl *.sublime-project | |
else | |
command subl . | |
fi | |
} |
View gist:7f47ee00da22dd52ff09
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
(function realTimeTrackTime () { | |
function padNumber (i) { | |
i = "" + i; | |
if (i.length == 1) return "0" + i; | |
return i; | |
} | |
function updatePlaytime () { | |
var d = new Date() | |
window.requestAnimationFrame(function () { |
View gist:1f38be8e28df87fced81
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
(function endTimesFromTrackLength () { | |
function padNumber (i) { | |
i = "" + i; | |
if (i.length == 1) return "0" + i; | |
return i; | |
} | |
function timestampToSecs (dateString) { | |
return Date.parse(dateString.replace(" ", "T") + "-07:00") / 1000; |
View gist:4189f5cf1452adac41fc
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
(function mixcloudify (startHour) { | |
var TALK_BREAK_MINIMUM = 4, // minimum length to insert a talk break | |
showDate; | |
function showTime () { | |
var start = startHour.split(":").map(function (item) { | |
return padNumber(item); | |
}); | |
return Date.parse([ |
View extended-tweet-embed.html
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
<blockquote class="twitter-tweet" cite="https://twitter.com/mroth/status/332642087713521664"> | |
<p>Best practices for nicely embedding a static tweet in a GitHub README.md? (Twitter's embed code obviously won't work due to SCRIPT tags.)</p> | |
<p>— Matthew Rothenberg (<a href="https://twitter.com/mroth/">@mroth</a>) | |
<a href="https://twitter.com/mroth/status/332642087713521664">May 9, 2013</a> · | |
<a href="https://twitter.com/intent/tweet?in_reply_to=332642087713521664">Reply</a> · | |
<a href="https://twitter.com/intent/retweet?tweet_id=332642087713521664">Retweet</a> · | |
<a href="https://twitter.com/intent/favorite?tweet_id=332642087713521664">Favourite</a> | |
</p> | |
</blockquote> |
View tumblr_export.js
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
!function () { | |
// You'll need an application registered at http://www.tumblr.com/oauth/apps | |
// Just put the OAuth Consumer Key here (Tumblr's version of application-auth | |
// is really simple and unsigned.) | |
const key = ""; | |
// Next, put your Tumblr domain name here. That might be 'benw.tumblr.com' or | |
// 'blog.benward.me'. | |
const domain = "example.tumblr.com"; | |
// Since we're pasting this on gist rather than giving you a full repo to |
View oembed.rb
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 'rubygems' | |
require "open-uri" | |
require 'nokogiri' | |
require 'json' | |
ARGV.each do |f| | |
doc = Nokogiri::HTML(open(f)) | |
doc.css('link[type="application/json+oembed"]').each do |link| | |
oembed_uri = link['href'] | |
oembed = open(oembed_uri).read |
View gist:2580401
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
{ | |
"theme": "Soda Light.sublime-theme", | |
"color_scheme": "Packages/Color Scheme - Default/Sunburst.tmTheme", | |
"font_size": 13, | |
"tab_size": 2, | |
"draw_white_space": "all", | |
"gutter": true, | |
"margin": 2, | |
"rulers": [78, 80], | |
"draw_minimap_border": false, |
View gist:1858216
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
window.location.search.split('&').filter(function(item,i){i=item.split('='); return(i[0]&&i[0]=='redirect_uri')}).forEach(function(u){window.location=unescape(u.split('=')[1])}) |
NewerOlder