Skip to content

Instantly share code, notes, and snippets.

Bruno Bronosky RichardBronosky

Block or report user

Report or block RichardBronosky

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@RichardBronosky
RichardBronosky / vscode_cheat_sheet.md
Last active Aug 23, 2019
Visual Studio code - VSCode Cheat Sheet - Keyboard Shortcuts
View vscode_cheat_sheet.md

VSCode Cheat Sheet

Keyboard Shortcuts

Jump to closing bracket

Cmd+Shift+\

Though I suggest changing it as follows:

editor.action.jumpToBracket Ctrl+]

@RichardBronosky
RichardBronosky / docker_build.sh
Last active Apr 10, 2019
My basic "build docker image from any directory" script. I have retyped this basic build script so many times that I basically didn't need to create this gist. Until I go a few weeks without doing Docker.
View docker_build.sh
#!/bin/bash -eux
readonly script_dir="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
cd "$script_dir"
docker build -t $(basename $PWD) .
@RichardBronosky
RichardBronosky / dnsmasq.conf
Last active Mar 12, 2019
Tools for masking/spoofing/proxying DNS
View dnsmasq.conf
#dnsmasq config, for a complete example, see:
# http://oss.segetech.com/intra/srv/dnsmasq.conf
#log all dns queries
log-queries
#dont use host's hosts file
no-hosts
addn-hosts=./etc/hosts
@RichardBronosky
RichardBronosky / nginx.conf
Created Mar 1, 2019
An A/B testing work-in-progress
View nginx.conf
user nginx;
worker_processes auto;
error_log /var/log/nginx/error.log;
pid /run/nginx.pid;
# Load dynamic modules. See /usr/share/nginx/README.dynamic.
include /usr/share/nginx/modules/*.conf;
events {
worker_connections 1024;
@RichardBronosky
RichardBronosky / similarities.sh
Created Feb 8, 2019
Identify how similar a file is to each file in a group of others.
View similarities.sh
#!/bin/bash
fileA="$1"
shift
for fileB in "$@"; do
(
# diff once grep twice with the help of tee and stderr
diff $fileA $fileB | \
tee >(grep -cE '^< ' >&2) | \
grep -cE '^> ' >&2
@RichardBronosky
RichardBronosky / source.bash
Last active Feb 8, 2019
A collection of tools for working with JS and JSON
View source.bash
:<<'DOCS'
* This script adds to your bash shell, a collection of tools for working with JS and JSON
* To install it, cd to where ever you checkout git repos and copy-paste the following line:
dst=jtools; git clone https://gist.github.com/81a3991aa63580283bf2f3db18ecf2fb.git $dst && echo -e "\n[[ -f $(dirs +0)/$dst/source.bash ]] && source $(dirs +0)/$dst/source.bash" >> ~/.bash_profile
DOCS
# converts serialized python to JSON
p2j() { python3 -c "import json, sys; print(json.dumps(eval(sys.stdin.read())))"; }
@RichardBronosky
RichardBronosky / create_systemd_service_unit.sh
Last active Apr 10, 2019
A slightly Raspberry Pi specific Systemd service unit example.
View create_systemd_service_unit.sh
service_name="sample.service"
service_desc="My Sample Service"
service_cmd="/usr/bin/python /home/pi/sample.py"
cat > /lib/systemd/system/$service_name <<EOF
[Unit]
Description=$service_desc
After=multi-user.target
@RichardBronosky
RichardBronosky / net-check.service
Last active Jan 30, 2019
watches a URL and logs it
View net-check.service
[Unit]
Description=Network Status Monitor
After=multi-user.target
[Service]
Type=idle
WorkingDirectory=/home/pi/
ExecStart=/bin/bash -c '/usr/local/bin/net-check.sh 15 https://gist.github.com/RichardBronosky/dd13161b72284c209c5b80d88f9cdb4a/raw/acdb3e2a6e3a55055aef16580e4e613e819d1f37/random-1m.txt >> /home/pi/net-check.log'
[Install]
@RichardBronosky
RichardBronosky / get_authorized_keys.sh
Created Jan 25, 2019
Get ssh keys for Raspberry Pi from GitHub
View get_authorized_keys.sh
sudo bash <<EOF
local_user=pi
github_user=RichardBronosky
umask 077
mkdir -p ~$local_user/.ssh
curl -sSL https://github.com/${github_user}.keys >> ~$local_user/.ssh/authorized_keys
chown -R $(id -u $local_user):$(id -g $local_user) ~$local_user/.ssh
EOF
You can’t perform that action at this time.