Skip to content

Instantly share code, notes, and snippets.

View butsjoh's full-sized avatar

Buts Johan butsjoh

  • Younited
  • Belgium
View GitHub Profile
@andywirv
andywirv / output.tf
Created November 3, 2017 16:16
Multi-line Output for Terraform
output "SSH Config" {
value = <<SSHCONFIG
### START Auto-gen SSH Config for ${random_pet.cluster_id.id} ###
Host ${random_pet.cluster_id.id}-bastion
User core
Hostname ${aws_instance.bastion.public_ip}
IdentityFile ~/.ssh/${random_pet.cluster_id.id}.key
Host ${random_pet.cluster_id.id}-agent
@gboudreau
gboudreau / AuthyToOtherAuthenticator.md
Last active May 11, 2025 00:10 — 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 your 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.

@cschiewek
cschiewek / x11_docker_mac.md
Last active March 25, 2025 13:23
X11 in docker on macOS

To forward X11 from inside a docker container to a host running macOS

  1. Install XQuartz: https://www.xquartz.org/
  2. Launch XQuartz. Under the XQuartz menu, select Preferences
  3. Go to the security tab and ensure "Allow connections from network clients" is checked.
  4. Run xhost + ${hostname} to allow connections to the macOS host *
  5. Setup a HOSTNAME env var export HOSTNAME=`hostname`*
  6. Add the following to your docker-compose:
 environment:
@myshov
myshov / function_invocation.js
Last active August 19, 2024 12:23
11 Ways to Invoke a Function
console.log(1);
(_ => console.log(2))();
eval('console.log(3);');
console.log.call(null, 4);
console.log.apply(null, [5]);
new Function('console.log(6)')();
Reflect.apply(console.log, null, [7])
Reflect.construct(function(){console.log(8)}, []);
Function.prototype.apply.call(console.log, null, [9]);
Function.prototype.call.call(console.log, null, 10);
@pygy
pygy / cancelPromise.md
Last active May 9, 2024 13:27
You can already cancel ES6 Promises

The gist: by having a Promise adopt the state of a forever pending one, you can suspend its then handlers chain.

Promise.pending = Promise.race.bind(Promise, [])

let cancel

new Promise(function(fulfill, reject) {
  cancel = function() {fulfill(Promise.pending())}
  setTimeout(fulfill, 1000, 5)
// Push the build to the nodes labled staging
node ('stage'){
//Perform a build on recieving a webhook from the github repo
stage ('Code Pull on Github') {
git credentialsId: 'github',
url: 'https://github.com/mugithi/blog.git'
}
//Build the container and tag it with abuild tag of the job
stage ('Container Image Builds') {
@ngtrieuvi92
ngtrieuvi92 / remove-unused-docker-images.sh
Last active October 17, 2021 07:41
Remove all unused docker image
#!/bin/bash
# Remove all exited container
docker rm $(docker ps -q -f status=exited)
# Remove none tag images (image with tag <none>)
docker images | grep "<none>" | awk '{print $3}' |xargs docker rmi -f
# Remove all images that is not using by any running container
# note: docker ps --format {{.Image} -> List all images of running container then set it as grep pattern
@ericboehs
ericboehs / icloud-caldav.rb
Last active June 30, 2021 10:27
Interface with Apple's iCloud CalDav Calendars
require 'rexml/document'
require 'rexml/xpath'
require 'http'
require 'icalendar'
HTTP::Request::METHODS = HTTP::Request::METHODS + [:report]
module AppleCalDav
class Client
attr_accessor :username, :password
@onjin
onjin / docker-compose.yml
Created September 5, 2016 09:17
example docker compose for postgresql with db init script
postgres:
image: postgres:9.4
volumes:
- ./init.sql:/docker-entrypoint-initdb.d/init.sql
@alexkehayias
alexkehayias / Gemfile
Last active May 23, 2019 23:00
Rails environment using Nix
source 'https://rubygems.org'
# OAuth
gem 'oauth2', '~> 1.0.0'
gem 'rails'