Skip to content

Instantly share code, notes, and snippets.

View nimaid's full-sized avatar

Ella Jameson nimaid

  • Tucson, AZ
View GitHub Profile
@nimaid
nimaid / listener_powerstager
Last active January 31, 2020 21:20
A helper script for opening a Powerstager listener
#!/bin/bash
set -e
PYTHONEXE=python
PSSCRIPT=/root/TheFatRat/tools/power.py
POWERSTAGER="$PYTHONEXE $PSSCRIPT"
function usage() {
echo Usage: $(basename $0) port
exit 1
@nimaid
nimaid / nimaid_lib.bash
Last active June 2, 2022 21:34
My library of useful bash functions
#!/bin/bash
# Returns the lowercase of a string
function lowercase() {
if [ -z "$1" ]; then
return
fi
echo "$1" | tr '[:upper:]' '[:lower:]'
}
@nimaid
nimaid / port_forward
Created February 8, 2020 08:02
A hard-coded single-file reverse SSH tunneling helper.
#!/bin/bash
set -e
# This is the IP address or URL of the server to reverse SSH tunnel to
FWHOST="my.server.com"
# This is the username to log into the server with
SSHUSER="my_username"
# This is your private key file, first encrypted with gpg, then encoded in base64
PRIVKEYGPG64="my_base64_gpg_ssh_private_key"
@nimaid
nimaid / cluster_images.py
Last active May 13, 2020 17:35
A CLI utility to cluster visually similar images together
#!/usr/bin/env python3
# Parse arguments before importing any other modules
import argparse
parser = argparse.ArgumentParser(description='Groups images together based on similarity (image clustering)')
parser.add_argument("-i", "--image_dir", type=str, required=True,
help='path to folder with images to be clustered')
parser.add_argument("-s", "--similarity", type=float, required=False, default=0.5,
help="the percent similarity needed to cluster together (0.0 - 1.0]")
@nimaid
nimaid / openvino.bash
Created May 11, 2020 16:34
Bash script to start Vino VNC server on Nvidia Jetson Nano
#!/bin/bash
export DISPLAY=:0
gsettings set org.gnome.Vino enabled true
gsettings set org.gnome.Vino prompt-enabled false
gsettings set org.gnome.Vino require-encryption false
/usr/lib/vino/vino-server &
@nimaid
nimaid / install_conda.bat
Last active April 28, 2024 11:57
Batch script to install Miniconda on Windows without user input
@echo off
set ORIGDIR="%CD%"
set MINICONDAPATH=%USERPROFILE%\Miniconda3
set CONDAEXE=%TEMP%\%RANDOM%-%RANDOM%-%RANDOM%-%RANDOM%-condainstall.exe
set "OS="
set "MCLINK="
where conda >nul 2>nul
@nimaid
nimaid / vcr_prepare_capture.bash
Last active June 6, 2020 06:30
A script to change video aspect ratio (lossless), and to change the peak audio volume (lossy)
#!/bin/bash
set -e
COMMAND_DIR=$PWD
SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )"
cd $COMMAND_DIR
# Parse arguments
IN_FILE=
@nimaid
nimaid / play_composite_fullscreen.bash
Last active June 8, 2020 02:19
A helper script to launch VLC optimized for playback to a VCR for recording
#!/bin/bash
pkill -f vlc
vlc \
--aspect-ratio 3:2 \
--no-qt-bgcone \
--no-osd \
--start-paused \
--play-and-pause \
@nimaid
nimaid / pb_pbtxt_converter.py
Last active September 5, 2024 05:19 — forked from arafatkatze/converter.py
Script to convert between .pb and .pbtxt files
#!/usr/bin/env python3
import argparse, os, pathlib, sys
def file_path(string):
if os.path.isfile(string):
return string
else:
raise FileNotFoundError(string)
ap = argparse.ArgumentParser()
ap.add_argument("-i", "--input", type=file_path, required=True,
@nimaid
nimaid / nvidia_helper.bash
Created August 6, 2020 16:04
Nvidia Utilization Helper Functions
#!/bin/bash
function gpu_usage_load() {
echo $(nvidia-smi --query-gpu=utilization.gpu --format=csv | tail -1 | tr -d '\040\011\012\015')
}
function gpu_usage_mem() {
echo $(nvidia-smi --query-gpu=utilization.memory --format=csv | tail -1 | tr -d '\040\011\012\015')
}