Skip to content

Instantly share code, notes, and snippets.

View brannondorsey's full-sized avatar
📡
Makin' the net work

Brannon Dorsey brannondorsey

📡
Makin' the net work
View GitHub Profile
@brannondorsey
brannondorsey / shutdown_idle_gpu_machine.sh
Last active October 16, 2020 19:30
Automate shutdown when no GPU processes are running and no users are logged in
#!/bin/bash
# A script for shutting down an idle VM with GPUs attached when they are idle and there
# are no users logged in. Add the below crontab via `crontab -e` to run this script every
# 10 minutes and append its output to a log:
#
# */10 * * * * ~/shutdown_idle_gpu_machine.sh >> ~/shutdown_idle_gpu_machine.log 2>&1
#
# This script should live in your HOME directory. Your user should have sudoer privileges.
@youkergav
youkergav / import.py
Last active August 29, 2022 22:55
Python script to import BreachCompilation to PostgreSQL database.
# Define imports.
from time import time, strftime
from datetime import datetime
from glob import iglob
from os import path, system
from sys import exc_info
from subprocess import Popen, PIPE
from curses import initscr, noecho, cbreak, echo, nocbreak, endwin
from psycopg2 import connect
@davidbradway
davidbradway / setup.md
Last active May 19, 2020 22:00
Set Up Docker On Raspberry Pi Raspbian Stretch Lite
@anis-campos
anis-campos / cross-compile_filebeat_arm.sh
Last active December 15, 2018 22:25
Cross-compile Elastic Filebeat for ARM with docker. Works Raspberry Pi 2
#----- Create a Docker for cross-compilation -----#
mkdir build && cd $_
docker run -it --rm -v `pwd`:/build golang:1.8.3 /bin/bash
#----- Inside docker -----#
go get github.com/elastic/beats
cd /go/src/github.com/elastic/beats/filebeat/
git checkout v5.6.3
GOARCH=arm go build
cp filebeat /build
exit
@innovia
innovia / kubernetes_add_service_account_kubeconfig.sh
Last active January 29, 2024 23:00
Create a service account and generate a kubeconfig file for it - this will also set the default namespace for the user
#!/bin/bash
set -e
set -o pipefail
# Add user to k8s using service account, no RBAC (must create RBAC after this script)
if [[ -z "$1" ]] || [[ -z "$2" ]]; then
echo "usage: $0 <service_account_name> <namespace>"
exit 1
fi
@brannondorsey
brannondorsey / one_liners.md
Last active July 8, 2022 05:07
One Liners

Count the number of unique characters in a file

# https://unix.stackexchange.com/questions/5010/how-can-i-count-the-number-of-different-characters-in-a-file
# works for linux. There is a variation for MacOS in the link ^
sed 's/\(.\)/\1\n/g' text.txt | sort | uniq -c # sort -nr # uncomment this to sort the list by frequency

Replace a string in all instances of files in a directory

@kylemcdonald
kylemcdonald / Covertee vs MRPT vs FAISS.ipynb
Last active April 23, 2017 01:31
Comparison between CT, MRPT and FAISS.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@ppwwyyxx
ppwwyyxx / tensorpack-gym.md
Last active May 23, 2018 09:29
placeholder for OpenAI Gym submission

Use A3C (asynchronous advantage actor-critic) written in TensorFlow. Training code, model & evaluation code at this repo

Gist doesn't have notifications, please use repo issues to discuss.

@c5e3
c5e3 / hackrf_baudline.sh
Created June 29, 2016 08:08
hackrf baudline script
#!/bin/bash
# ./hackrf_baudline.sh <frequency> <samplerate> <IFgain> <BBgain>
FFT=$((${2}/1000000*2048))
mkfifo /tmp/fifo
hackrf_transfer -r /tmp/fifo -l $3 -g $4 -f $1 -s $2 >> /dev/null &
cat /tmp/fifo | baudline -stdin -quadrature -record -channels 2 -flipcomplex -format s8 -overlap 100 -memory 512 -fftsize ${FFT} -basefrequency $1 -samplerate $2 && rm /tmp/fifo
@epixoip
epixoip / 8x1080.md
Last active March 20, 2024 17:14
8x Nvidia GTX 1080 Hashcat Benchmarks