Skip to content

Instantly share code, notes, and snippets.

View consti's full-sized avatar
:shipit:
casting spells

Constantin Hofstetter consti

:shipit:
casting spells
View GitHub Profile
@consti
consti / add-team-repos.js
Last active August 24, 2023 23:24 — forked from davidrleonard/add-team-to-repos.js
Add a new team to all Github repos in an organization
/*
* Adds a team to all the repos in a Github organization. This is a tedious
* process in the UI. You'll need a newer version of node to run this (e.g 9+)
* because it uses async/await.
*
* Instructions:
*
* 1. Generate access token here: https://github.com/settings/tokens
* 2. Find TEAM_ID with this API call:
* curl -u USERNAME:PERSONAL_ACCESS_TOKEN -H "Accept: application/vnd.github.v3+json" https://api.github.com/orgs/ORG/teams\?per_page\=100
@consti
consti / emoji_country_nationality_list.csv
Last active February 26, 2022 06:25
List of countries, emojis and nationalities/demonyms
Emoji ISO 3166 Code Name Demonym 1 Demonym 2 Demonym 3
🇦🇩 AD Andorra Andorran
🇦🇪 AE United Arab Emirates Emirian Emirati
🇦🇫 AF Afghanistan Afghani Afghan
🇦🇬 AG Antigua and Barbuda Antiguan
🇦🇮 AI Anguilla Anguillan
🇦🇱 AL Albania Albanian Alabanian
🇦🇲 AM Armenia Armenian Hayastani
🇦🇴 AO Angola Angolan
🇦🇶 AQ Antarctica Antarctic
@consti
consti / AuthyToOtherAuthenticator.md
Created February 7, 2022 03:38 — forked from gboudreau/AuthyToOtherAuthenticator.md
Export TOTP tokens from Authy

Generating Authy passwords on other authenticators


There is an increasing count of applications which use Authy for two-factor authentication. However many users who aren't using Authy, have their own authenticator setup up already and do not wish to use two applications for generating passwords.

Since I use 1Password for all of my password storing/generating needs, I was looking for a solution to use Authy passwords on that. I couldn't find any completely working solutions, however I stumbled upon a gist by Brian Hartvigsen. His post had a neat code with it to generate QR codes for you to use on your favorite authenticator.

His method is to extract the secret keys using Authy's Google Chrome app via Developer Tools. If this was not possible, I guess people would be reverse engineering the Android app or something like that. But when I tried that code, nothing appeared on the screen. My guess is that Brian used the

  • Dynamic Dispatch
  • Dynamic Method
  • Ghost Methods
  • Dynamic Proxies
  • Blank Slate
  • Kernel Method
  • Flattening the Scope (aka Nested Lexical Scopes)
  • Context Probe
  • Class Eval (not really a 'spell' more just a demonstration of its usage)
  • Class Macros
echo "0 */17 * * * say potato" > ~/.crontab
crontab ~/.crontab
@consti
consti / raspberry-pi-vpn-router.md
Created March 16, 2017 13:25 — forked from superjamie/raspberry-pi-vpn-router.md
Raspberry Pi VPN Router

Raspberry Pi VPN Router

This is a quick-and-dirty guide to setting up a Raspberry Pi as a "router on a stick" to PrivateInternetAccess VPN.

Requirements

Install Raspbian Jessie (2016-05-27-raspbian-jessie.img) to your Pi's sdcard.

Use the Raspberry Pi Configuration tool or sudo raspi-config to:

@consti
consti / gist:8bb686c09c393917b874a88b10d2e31f
Created August 25, 2016 08:45
Bluetooth core settings Mac
defaults write com.apple.BluetoothAudioAgent "Apple Bitpool Max (editable)" 80
defaults write com.apple.BluetoothAudioAgent "Apple Bitpool Min (editable)" 80
defaults write com.apple.BluetoothAudioAgent "Apple Initial Bitpool (editable)" 80
defaults write com.apple.BluetoothAudioAgent "Apple Initial Bitpool Min (editable)" 80
defaults write com.apple.BluetoothAudioAgent "Negotiated Bitpool" 80
defaults write com.apple.BluetoothAudioAgent "Negotiated Bitpool Max" 80
defaults write com.apple.BluetoothAudioAgent "Negotiated Bitpool Min" 80
sudo killall bluetoothaudiod
@consti
consti / el_capitan.md
Last active September 11, 2015 03:01
Mac OS X El Capitan – Homebrew / Rails
  • Download the El Capitan Beta and install
  • Download and install XQuartz: https://xquartz.macosforge.org/landing/
  • Download the Xcode Beta and install (drag & drop into /Applications)
  • Rename Xcode-Beta.app to Xcode.app (remove old version)
  • Start Xcode.app and agree to ToS and finish installation
  • Start up iTerm/Terminal:
# Install Xcode extensions
xcode-select --install
@consti
consti / missing_indices.sql
Created May 13, 2015 07:11
Find missing indices in postgres
SELECT relname, seq_scan-idx_scan AS too_much_seq, case when seq_scan-idx_scan>0 THEN 'Missing Index?' ELSE 'OK' END, pg_relation_size(relname::regclass) AS rel_size, seq_scan, idx_scan
FROM pg_stat_all_tables
WHERE schemaname='public' AND pg_relation_size(relname::regclass)>80000 ORDER BY too_much_seq DESC;
@consti
consti / wtd_bangkok.md
Last active August 2, 2016 05:04
What to do in Bangkok

What to do in Bangkok

Allgemeines

Am Flughafen eine Prepaid Simkarte holen (kostet bei True Mobile ca. 400฿ für 30 Tage Internet) - dann Foursquare auf dem Handy installieren und Google Maps (BTS Stationen auf Thai!) und Apple Maps (BTS Stationen auf Englisch!) zur Navigation verwenden.

Geldautomaten in Thailand verrechnen beim Abheben mit einer Ausländischen Geldkarte bis zu 180฿ Gebühr. Deshalb am Besten immer gleich "ausreichend" Geld abheben bzw. Euro mitbringen und am Flughafen in Bangkok (Siam Commercial Bank) oder in der Stadt ("SuperRich Exchange") wechseln: der Kurs hier ist meistens sehr sehr gut.

Nicht auf den "Hat heute geschlossen, ich kann euch was anderes zeigen"-Trick reinfallen. Entspricht meistens nicht der Wahrheit (im Internet nachschauen) und führt nur zum Geschäft des Schwagers ("günstige Anzüge") oder dem Restaurant der Cousine ("real thai food") :).