Skip to content

Instantly share code, notes, and snippets.

View RichardBronosky's full-sized avatar

Bruno Bronosky RichardBronosky

View GitHub Profile
@RichardBronosky
RichardBronosky / nc.md
Created November 10, 2020 20:52 — forked from jtbonhomme/nc.md
Using Netcat for File Transfers

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 November 9, 2020 07:04
Convert the output of `aws sts get-session-token` to shell export statements
#!/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 November 2, 2020 18:01 — forked from echristopherson/vimcat.sh
Modified version of Matthew Wozniski's 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"
#!/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 July 2, 2020 19:16
grepped top (top, limited to commands filtered via regex arg)
# 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 June 30, 2020 17:56
Add IP to AWS WAF IP set via CLI
#!/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 June 29, 2020 18:40
Script for toggling my Raspberry Pi NeoPixel chromakey ringlight
#!/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 June 11, 2020 17:01 — 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
#!/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"
)
@RichardBronosky
RichardBronosky / README.md
Last active August 17, 2023 15:33
A bash plugin to manage plugins

bash-bashplug

A bash plugin to manage plugins

Installation

Set up bash_plugins folder

(Skip this step if you already have a bash_plugins folder.)

{
# simply copy-pasta this whole block, or customize these vars and copy-pasta the rest
@RichardBronosky
RichardBronosky / README.md
Last active August 17, 2023 15:34
A bash plugin to make cd better

bash-cdl

A bash plugin to make cd better

Installation

Set up bash_plugins folder

(Skip this step if you already have a bash_plugins folder.)

{
# simply copy-pasta this whole block, or customize these vars and copy-pasta the rest