Skip to content

Instantly share code, notes, and snippets.

View benjaminoakes's full-sized avatar

Ben Oakes benjaminoakes

View GitHub Profile
@dhh
dhh / linux-setup.sh
Last active July 1, 2024 16:45
linux-setup.sh
# THIS LINUX SETUP SCRIPT HAS MORPHED INTO A WHOLE PROJECT: HTTPS://OMAKUB.ORG
# PLEASE CHECKOUT THAT PROJECT INSTEAD OF THIS OUTDATED SETUP SCRIPT.
#
#
# Libraries and infrastructure
sudo apt update -y
sudo apt install -y \
docker.io docker-buildx \
build-essential pkg-config autoconf bison rustc cargo clang \
# Simulates a race condition for testing. The first try always fails, the second try succeeds.
#
# Abstract example:
#
# RaceConditionCollection.new(active_record_model.associated_collection)
#
# Concrete example:
#
# RaceConditionCollection.new(blog_post.comments)
class RaceConditionCollection
// ==UserScript==
// @name Google Push to Talk
// @namespace http://tampermonkey.net/
// @version 0.5
// @description Hold down the spacebar to unmute the mic in Google Meet; tapping the spacebar toggles mute.
// @author Marc Reynolds (github.com/marcreynolds)
// @match https://meet.google.com/*
// @updateUrl https://gist.github.com/marcreynolds/6c629eaf8bfe87986ebe90ebea7daf85/raw/google-meet-spacebar.user.js
// @grant none
// ==/UserScript==
<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0">
<channel>
<title>Asimov - Foundation Trilogy</title>
<description>Isaac Asimov's Foundation Trilogy in BBC Audio from the Internet Archive</description>
<item>
<title>Part 1 of 8</title>
<enclosure url="http://www.archive.org/download/IsaacAsimov-TheFoundationTrilogy/IsaacAsimov-Foundation1Of8_64kb.mp3" type="audio/mpeg"/>
</item>
gist_urls_file=$(mktemp)
gist -l | sed 's/ .*$//' > $gist_urls_file
cat $gist_urls_file | while read -r line; do
gist_url="$line"
gist_id="$(echo $gist_url | sed 's|https://gist.github.com/||')"
clone_url="git@gist.github.com:$gist_id.git"
git clone $clone_url
done
@gboudreau
gboudreau / AuthyToOtherAuthenticator.md
Last active July 3, 2024 05:15 — forked from Ingramz/AuthyToOtherAuthenticator.md
Export TOTP tokens from Authy
@marcreynolds
marcreynolds / google-meet-spacebar.user.js
Last active June 15, 2020 07:32
Google Meet/Hangouts Push-to-Talk
// ==UserScript==
// @name Google Push to Talk
// @namespace http://tampermonkey.net/
// @version 0.5
// @description Hold down the spacebar to unmute the mic in Google Meet; tapping the spacebar toggles mute.
// @author Marc Reynolds (github.com/marcreynolds)
// @match https://meet.google.com/*
// @updateUrl https://gist.github.com/marcreynolds/6c629eaf8bfe87986ebe90ebea7daf85/raw/google-meet-spacebar.user.js
// @grant none
// ==/UserScript==
# Debugging helper, useful while fixing N+1 problems
# Based on https://gist.github.com/crazymykl/b526e0ed6b285b3c4e77
def count_queries(log: false, &block)
ActiveRecord::Base.logger = Logger.new(STDOUT) if log
query_count = 0
increment_count = -> (*) { query_count += 1 }
ActiveSupport::Notifications.subscribed(increment_count, 'sql.active_record', &block)
query_count
end
@zhengjia
zhengjia / capybara cheat sheet
Created June 7, 2010 01:35
capybara cheat sheet
=Navigating=
visit('/projects')
visit(post_comments_path(post))
=Clicking links and buttons=
click_link('id-of-link')
click_link('Link Text')
click_button('Save')
click('Link Text') # Click either a link or a button
click('Button Value')