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 November 15, 2024 19:55
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="[email protected]:$gist_id.git"
git clone $clone_url
done
@gboudreau
gboudreau / AuthyToOtherAuthenticator.md
Last active November 15, 2024 12:45 — forked from Ingramz/AuthyToOtherAuthenticator.md
Export TOTP tokens from Authy

Exporting your 2FA tokens from Authy to transfer them into another 2FA application

IMPORTANT - Update regarding deprecation of Authy desktop apps

Past August 2024, Authy stopped supported the desktop version of their apps:
See Authy is shutting down its desktop app | The 2FA app Authy will only be available on Android and iOS starting in August for details.

And indeed, after a while, Authy changed something in their backend which now prevents the old desktop app from logging in. If you are already logged in, then you are in luck, and you can follow the instructions below to export to tokens.

If you are not logged in anymore, but can find a backup of the necessary files, then restore those files, and re-install Authy 2.2.3 following the instructions below, and it should work as expected.

@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')