Skip to content

Instantly share code, notes, and snippets.

View bilbof's full-sized avatar
😃
👍

Bill Franklin bilbof

😃
👍
View GitHub Profile

Keybase proof

I hereby claim:

  • I am bilbof on github.
  • I am billfranklin (https://keybase.io/billfranklin) on keybase.
  • I have a public key whose fingerprint is 043E E74B 05E6 AF25 D6C7 692E 1CC3 9911 7A8E 87F3

To claim this, I am signing this object:

@bilbof
bilbof / dhcp.sh
Created March 17, 2016 12:45
Fixing DCHP lease connection
while :
do
echo "add State:/Network/Interface/en0/RefreshConfiguration temporary" | sudo scutil
echo "refresh"
sleep 5
done
# this script fetches the content items for finders (search UIs) on GOV.UK
require 'httparty'
def request(url)
JSON.parse(HTTParty.get(url).body)
end
def finders_urls
finders = request('https://www.gov.uk/api/search.json?filter_content_store_document_type=finder&count=100&fields=link').dig('results')
finders.map { |finder| finder['link'] }
@bilbof
bilbof / dedupe.rb
Created October 22, 2019 14:27
De-duplicate queries w/counts
require 'csv'
require 'json'
# Needs an in.csv with query and count columns.
def normalise_query(query)
query.downcase.gsub('+', ' ').strip # .split(' ').sort.join(' ')
end
data = File.open('in.csv').read
@bilbof
bilbof / redis-bigkeys.rb
Created August 5, 2024 09:42
redis ruby bigkeys
redis = Redis.new
top_n = 20
# top N keys and their size in kb
big_keys = redis.keys.map { |k| [k, redis.memory("usage", k) / 1024.0] }.sort_by { |a,b| b }.last(top_n)
@bilbof
bilbof / netflix-bookmarks.html
Last active April 27, 2025 20:57
Bypasses this Netflix error message with these browser bookmarks: "Your device isn’t part of the Netflix Household for this account - Did we get it wrong? Watch temporarily until you’re back on your Netflix Household Wi-Fi or sign out."
<!DOCTYPE NETSCAPE-Bookmark-file-1>
<!-- This is an automatically generated file.
It will be read and overwritten.
DO NOT EDIT! -->
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=UTF-8">
<TITLE>Bookmarks</TITLE>
<H1>Bookmarks</H1>
<DL><p>
<DT><H3 ADD_DATE="1745785481" LAST_MODIFIED="1745785531">Netflix</H3>
<DL><p>