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
// ==UserScript== | |
// @name Ruby Doc Extras | |
// @description Adds a version-switcher widget and other extras to ruby-doc.org | |
// @include https://ruby-doc.org/core-* | |
// @include https://ruby-doc.org/stdlib-* | |
// @run-at document-idle | |
// ==/UserScript== | |
class RubyDocExtras { | |
static setupClasses = []; |
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
#!/bin/sh | |
yow_url=https://raw.githubusercontent.com/shlomif/fortune-mod/eeea80856c35f1e4487eed3e59829539eb12c07b/fortune-mod/datfiles/zippy | |
all_yows() { | |
test -e './yow.dat' || curl --silent $yow_url | sed -E 's#(.)%#\1\\%#g' > yow.dat | |
cat yow.dat | |
} | |
total_yow_count() { |
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
#!/bin/sh | |
dir=$(mktemp -d) | |
unzip "$1" -d "$dir" | |
for f in $dir/*.m4a; do | |
echo "converting $f to mp4…" | |
afconvert -f mp4f "$f" | |
done |
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
#!/bin/sh | |
# https://developer.twitter.com/en/docs/tweets/timelines/api-reference/get-statuses-home_timeline | |
since_id() { | |
if [ -r './.since_id' ]; then | |
cat './.since_id' | |
else | |
echo 100000 | |
fi | |
} |
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
#!/bin/sh | |
# | |
# Given a Y*uTube video ID, this grabs JSON metadata from publically available | |
# HTML. No API! | |
# | |
# Requires: | |
# * curl | |
# * node | |
# * pup https://github.com/ericchiang/pup | |
# |
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
#!/bin/sh | |
TZ=UTC jq -rc ' | |
.[] | | |
. + { | |
hour: .created_at | strptime("%a %b %d %T %z %Y")[3], | |
quoted_status: .quoted_status | |
} | | |
{ hour: .hour } + | |
if .retweeted_status|type == "object" then |
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
#!/bin/sh | |
# This grabs all tweets from the given user (or as many as Twitter will give | |
# you; the docs say 3200) and stores them as a JSON array in the file | |
# ${screen_name}-timeline.json in the current directory. | |
# | |
# It requires jq and twurl, and assumes you have set up twurl with working API | |
# credentials. | |
# | |
# It doesn't clean up after itself, so make sure the current directory is clear | |
# of any files matching ${screen_name}-*.json before running. |
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
#!/bin/sh | |
# | |
# usage: tw-get-likes twitter_username | |
# | |
# Requires: | |
# * twurl | |
# * jq | |
# | |
# The API is rate-limited to 75 calls in a 15 minute window | |
# but this doesn't handle rate limit error returns. Who has 15k likes anyway? |
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
#!/usr/bin/env ruby | |
# https://www.meetup.com/ChicagoRuby/events/241147344/ | |
class Grid | |
attr_accessor :board, :size | |
def initialize(size) | |
@size = size | |
@board = Array.new(size) { Array.new(size, ". ") } | |
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
#!/bin/sh | |
case "$1" in | |
followers) | |
api_endpoint="/1.1/followers/list.json" | |
output_prefix="followers" | |
;; | |
following) | |
api_endpoint="/1.1/friends/list.json" |