Skip to content

Instantly share code, notes, and snippets.

Avatar

Bruno Bronosky RichardBronosky

View GitHub Profile
@RichardBronosky
RichardBronosky / Dockerfile
Created Jan 11, 2021
Jupyter notebook with bash kernel and ability to `su -` to install software
View Dockerfile
# https://docs.docker.com/engine/reference/builder/
# /home/jovyan/work
ARG BASE_CONTAINER=jupyter/minimal-notebook
FROM $BASE_CONTAINER
LABEL maintainer="Bruno Bronosky <bruno@bronosky.com>"
USER root
# Install all OS dependencies for fully functional notebook server
RUN pip install bash_kernel && python -m bash_kernel.install
@RichardBronosky
RichardBronosky / README.md
Last active Jan 4, 2021
A homebrew formula to build vim with support for pyenv version of python
View README.md

A homebrew formula to build vim with support for pyenv version of python

Build

  1. Patch /usr/local/Homebrew/Library/Taps/homebrew/homebrew-core/Formula/vim.rb
  2. Build
    brew reinstall --verbose --debug --build-from-source vim
  3. Locate your dynamic library with find /Users/bronoric/.pyenv/ -name '*libpython3*.dylib'
    • It's probably going to contain darwin in the path.
@RichardBronosky
RichardBronosky / nc.md
Created Nov 10, 2020 — forked from jtbonhomme/nc.md
Using Netcat for File Transfers
View nc.md

Netcat is like a swiss army knife for geeks. It can be used for just about anything involving TCP or UDP. One of its most practical uses is to transfer files. Non *nix people usually don't have SSH setup, and it is much faster to transfer stuff with netcat then setup SSH. netcat is just a single executable, and works across all platforms (Windows,Mac OS X, Linux).

Destination

On the receiving (destination) terminal, run:

nc -l -p 1234 > out.file 
@RichardBronosky
RichardBronosky / aws_token.py
Last active Nov 9, 2020
Convert the output of `aws sts get-session-token` to shell export statements
View aws_token.py
#!/usr/bin/env python
import json, re, sys
for k,v in json.load(sys.stdin)['Credentials'].items(): print("export AWS{}='{}'".format(re.sub('([A-Z])', r'_\1', k).upper(),v))
@RichardBronosky
RichardBronosky / vimcat.sh
Created Nov 2, 2020 — forked from echristopherson/vimcat.sh
Modified version of Matthew Wozniski's vimcat.sh
View vimcat.sh
#!/bin/bash
#!/usr/bin/env vim
#! This is a bash script that executes itself as a vimscript to do its work
#! vim:ft=vim:ts=2:sts=2:sw=2
: if 0
tmpfile=$(mktemp -t vimcat.XXXXXXXX)
exec 9<>"$tmpfile"
rm "$tmpfile"
View evernote_code_block_without_double_empty_lines.sh
#!/bin/bash
convert_text(){
python3 -c 'import html, sys; [print(html.escape(l), end="") for l in sys.stdin]' | \
sed -E $'
1i\\\n<span style="-en-clipboard:true;"><br/></span><div style="-en-codeblock:true;"><div>\n
s, ,\&nbsp;,g
s,$,<br/>,
s,^<br/>$,<div><br/></div>,
$a\\\n</div></div>\n
@RichardBronosky
RichardBronosky / gtop.sh
Created Jul 2, 2020
grepped top (top, limited to commands filtered via regex arg)
View gtop.sh
# only tested on macOS
gtop(){ pattern="${1:-WindowServer}"; top $(ps -haxl | awk '/'"$pattern"'/{print "-pid " $2}'); }
gtop Chrome
@RichardBronosky
RichardBronosky / add_ip_to_ipset.sh
Created Jun 30, 2020
Add IP to AWS WAF IP set via CLI
View add_ip_to_ipset.sh
#!/usr/bin/env bash -eux
function usage(){
cat<<USAGE
NAME
add_ip_to_ipset - Add a single IP to a WAF IP Set
SYNOPSIS
add_ip_to_ipset IP IP_SET_NAME
@RichardBronosky
RichardBronosky / neo
Created Jun 29, 2020
Script for toggling my Raspberry Pi NeoPixel chromakey ringlight
View neo
#!/usr/bin/env python3
"""Script for toggling my Raspberry Pi NeoPixel chromakey ringlight
Usage:
activate with default power of 64/256:
./neo
activate full power:
./neo 64
deactivate:
./neo off
@RichardBronosky
RichardBronosky / aws.setup-credentials.sh
Last active Jun 11, 2020 — forked from sobi3ch/aws.setup-credencials
After downloading default user accessKeys.csv file from AWS console you can setup default profile with following bash function
View aws.setup-credentials.sh
#!/bin/bash -eu
aws.setup-credentials(){
local FILE="${1:--/dev/null}"
local file_paths_to_check=(
"$FILE"
"./accessKeys.csv"
"$HOME/accessKeys.csv"
"$HOME/Downloads/accessKeys.csv"
)