Skip to content

Instantly share code, notes, and snippets.

View mira-milk-frother-instructions.md
  • To warm and froth milk:
Push the on button once
- blue indicator lights up
  • To only warm milk:
Push the on button two time
- blue indicator lights up (not helpful)
@xcsrz
xcsrz / es-backup-control.py
Created Oct 10, 2020
This python script is used to increase the number of replicas in an ES cluster and force those new replicas to be allocated to a new host to enable a filesystem backup of the ES data directory.
View es-backup-control.py
from requests import get, post, put
from json import dumps, loads
from sys import argv
from math import ceil
commands = []
def addShard(idx, shard):
commands.append({
"allocate" : {
@xcsrz
xcsrz / material-ui-starter-pre-react-hooks.sh
Created May 8, 2020
When you need to jump start a material-ui project with the pre-hooks version of react. (react v16.7, material-ui v3.7.1)
View material-ui-starter-pre-react-hooks.sh
curl https://codeload.github.com/mui-org/material-ui/tar.gz/v3.7.1 | tar -xz --strip=2 material-ui-3.7.1/examples/create-react-app
@xcsrz
xcsrz / certificate-dates.sh
Created Apr 16, 2020
Print the dates from an SSL certificate
View certificate-dates.sh
openssl x509 -noout -dates -in cert.pem
@xcsrz
xcsrz / pemify-your-private-ssh-key.sh
Created Apr 5, 2020
This one command is so hard to track down every 3 years when I need it. So many posts incorrectly insist the private key is in PEM format already. In truth, it depends on how the key pair was created (openssl vs ssh-keygen).
View pemify-your-private-ssh-key.sh
# NOTE: this updates the file in place, do you have a backup?
ssh-keygen -p -m PEM -f ~/.ssh/id_rsa
@xcsrz
xcsrz / abort-trap-6-fix.sh
Created Mar 11, 2020
fix for when `macos catalina upgrade` makes random scripts bomb with `Abort trap: 6`
View abort-trap-6-fix.sh
brew update && brew upgrade && brew install openssl
cd /usr/local/Cellar/openssl/1.0.2*/lib
sudo cp libssl.1.0.0.dylib libcrypto.1.0.0.dylib /usr/local/lib/
cd /usr/local/lib
sudo ln -s libssl.1.0.0.dylib libssl.dylib
sudo ln -s libcrypto.1.0.0.dylib libcrypto.dylib
@xcsrz
xcsrz / bitbucket-archive.py
Last active Mar 4, 2020
With atlassian falling apart and abandoning mercurial (the only reason to use bitbucket unless you're one of those anti-microsoft holdouts) you may find yourself looking to collect all your bitbucket repos to take elsewhere ... like ... github. This script is the first step. This is the first draft, only tested on mac running python 3.7 but shou…
View bitbucket-archive.py
from requests import get
from os import environ, getcwd, chdir, mkdir, system
from json import dumps
basedir = getcwd() + '/repos'
mkdir(basedir)
username=environ['BITBUCKET_USER']
password=environ['BITBUCKET_PASS']
team=environ['BITBUCKET_TEAM']
@xcsrz
xcsrz / adb-fix-kodi-back-button-amazon-fire-tv.md
Last active May 23, 2020
Does it irritate anyone else as much as me when you hit the back button and the video keep on playing but all you can see is the audio and it's not clear how to make the audio stop? This fixes that on FireTV+Kodi.
View adb-fix-kodi-back-button-amazon-fire-tv.md

Run Directly

curl https://gist.githubusercontent.com/xcsrz/780017ebbd64b2435dc58b1053bf4858/raw/f9d36a87daba4e464a1e61d35172c313ee2fea7f/adb-fix-kodi-back-button-amazon-fire-tv.sh | bash
@xcsrz
xcsrz / wait-until-published.py
Created Apr 24, 2019
Python function to wait for a recently published version of an npm package to become available. Too many times I've been bitten by npm publish returning but the package not becoming available for several seconds, minutes and sometimes even hours later. If you automate your deployment with python this can help you too.
View wait-until-published.py
import sys
import json
import time
# pip install npm
from npm.bindings import npm_run
def wait(package, version):
while True:
err, raw = npm_run('view','--json', package)