Skip to content

Instantly share code, notes, and snippets.

View consti's full-sized avatar
:shipit:
Focusing 🦄

Constantin Hofstetter consti

:shipit:
Focusing 🦄
View GitHub Profile
@consti
consti / hosts
Last active April 23, 2024 19:50
/etc/hosts to block shock sites etc.
# This hosts file is brought to you by Dan Pollock and can be found at
# http://someonewhocares.org/hosts/
# You are free to copy and distribute this file for non-commercial uses,
# as long the original URL and attribution is included.
#<localhost>
127.0.0.1 localhost
127.0.0.1 localhost.localdomain
255.255.255.255 broadcasthost
::1 localhost
@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 / 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

@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 / 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;
echo "0 */17 * * * say potato" > ~/.crontab
crontab ~/.crontab
@consti
consti / post-commit
Created July 10, 2012 09:57
Take a photo of you, whenever you make a commit
#!/bin/sh
#
# Take a photo of you, whenever you make a commit
#
# This is an improved version of Víctor Martínez original post:
# http://coderwall.com/p/xlatfq
#
# Improvements:
  • 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
@consti
consti / .osx
Created July 29, 2012 17:16
Mac OS X Lion defaults
# ~/.osx — http://mths.be/osx
###############################################################################
# General UI/UX #
###############################################################################
# Set computer name (as done via System Preferences → Sharing)
scutil --set ComputerName "MathBook Pro"
scutil --set HostName "MathBook Pro"
scutil --set LocalHostName "MathBook-Pro"
@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: