Skip to content

Instantly share code, notes, and snippets.

@brbsix
brbsix / .bash_functions
Last active August 29, 2015 14:27
Identify changes to a filesystem
#!/bin/bash
# Identify changes to a filesystem
fsdiff(){
(
defaultdirs=(.)
localdirs=("$HOME")
systemdirs=(/etc /home /opt /root /usr /var)
if (( $# == 0 )); then
@brbsix
brbsix / README.md
Created September 5, 2015 23:16
Connecting to a CoreOS VirtualBox guest

Connecting to a CoreOS VirtualBox guest

For future reference, here are the steps to add a SSH key to a CoreOS guest machine's authorized_keys:

1. download configuration generator script

wget https://raw.github.com/coreos/scripts/master/contrib/create-basic-configdrive

2. mark script as executable

@brbsix
brbsix / keybase.md
Last active February 5, 2016 03:57

Keybase proof

I hereby claim:

  • I am brbsix on github.
  • I am brbsix (https://keybase.io/brbsix) on keybase.
  • I have a public key whose fingerprint is 25B6 9A6A EB57 830F 5B25 E9C1 3B5B C114 80C7 62BC

To claim this, I am signing this object:

@brbsix
brbsix / makepdf
Created April 7, 2016 15:30
wkhtmltopdf
#!/bin/bash
#
# Create a pdf from HTML or URL
cleanup(){
# check whether $TEMPDIR exists and is a subdir of /tmp
if [[ -d $TEMPDIR && $(dirname "$TEMPDIR") = /tmp ]]; then
rm -rf "$TEMPDIR"
fi
@brbsix
brbsix / scraper.py
Last active August 19, 2016 15:04
Scrape new entries
# -*- coding: utf-8 -*-
"""Poll websites for new entries"""
# standard imports
import itertools
from collections import deque
# external imports
from pickleshare import PickleShareDB
@brbsix
brbsix / .bash_aliases
Last active March 31, 2017 15:12
Bash completion for git aliases
# [Git]
_completion_loader git
alias g="git"
__git_complete g _git
alias ga="git add"
__git_complete ga _git_add
alias gap="git add --patch"
__git_complete gap _git_add
alias gb="git branch"
__git_complete gb _git_branch
{
"fallback": [
{ "class_name": "com.google.android.libraries.youtube.player.background.BackgroundTransitioner", "method_name": "updateBackgroundService", "actions": [
{ "name": "set_field_boolean_before_method", "field_name": "playbackModality.isInBackground", "value": true }
] },
{ "class_name": "com.google.android.libraries.youtube.innertube.model.PlayabilityStatusModel", "method_name": "isPlayable", "actions": [
{ "name": "set_field_boolean_before_method", "field_name": "isBackgroundable", "value": true }
] },
{ "class_name": "com.google.android.apps.youtube.app.background.BackgroundSettings", "method_name": "getBackgroundAudioSetting", "actions": [
{ "name": "return_string", "value": "on" }
@brbsix
brbsix / pyqt5_scraper.py
Created June 16, 2016 13:07
PyQt5 Scraper
"""Render HTML for scraping"""
# -*- coding: utf-8 -*-
import os
import sys
from contextlib import contextmanager
from multiprocessing import Pool
try:
TimeoutError
@brbsix
brbsix / mktempenv.sh
Last active August 19, 2020 21:44
mktempenv
# Create a temporary pyenv virtualenv
mktempenv(){
[[ $1 =~ ^(-h|--help)$ ]] && {
echo "Usage: ${FUNCNAME[0]} [VERSION] [NAME]"
echo 'Create a temporary pyenv virtualenv'
return 0
}
local pyenv_version=${1:-$(pyenv version-name)}
local venv_name=${2:-$(mktemp --dry-run -d "tmp-$pyenv_version-XXXXXX")}
@brbsix
brbsix / send_or_receive.sh
Created January 22, 2021 00:48
send_or_receive.sh
#!/bin/bash
#
# Send or receive data to/from another device on the network.
PROGRAM=${0##*/}
LOCAL_IP=192.168.1.100
PORT=6666
PASSWORD=topsecret