Skip to content

Instantly share code, notes, and snippets.

@raidzero
raidzero / divvy.sh
Last active February 15, 2023 09:35
OS X Divvy emulation for EWMH-compliant (Unix-like) Window Managers
#!/bin/sh
DEST="$1"
if [ -z "$DEST" ]; then
echo "USAGE: $0 [location]"
echo -e "\nsupported locations: "
echo -e "\thalf-left, half-right"
echo -e "\tthird-left, third-middle, third-right"
echo -e "\tquarter-top-left, quarter-rop-right, quarter-bottom-left, quarter-bottom-right"
@raidzero
raidzero / getID.sh
Created March 3, 2014 00:22
Print game ID of wii/gamecube file and download game cover artwork
#!/bin/sh
# this script will print internal game name and ID to the screen for gamecube/wii games and download artwork
ARTWORK_DIR=~/storage/ROMs/artwork
function die()
{
rm /tmp/game{Name,ID,WBFS} &> /dev/null
echo $1
exit $2
@raidzero
raidzero / ipblock.sh
Created June 7, 2016 19:29
Auto block port scanners from openvpn server
#!/bin/bash
# this parses the openvpn connection log for any suspected attackers and blocks them, also uses geoiplookup to show the country :)
LIST=$1
COUNT=0
for IP in `cat /var/log/openvpn.log | grep attack | grep -oE "[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}" | sort -u`; do
LOCATION=`geoiplookup $IP | awk -F ": " '{print$2}'`
if [ -z "$LIST" ]; then
# check for existing rule
@raidzero
raidzero / blocklist-update.sh
Created February 25, 2014 04:13
Script to update transmission blocklists using a list of blocklists from iblocklist.com
#!/bin/sh
:<<END_DOC
blocklist updater - for transmission
Written by raidzero for linux
BLOCKLIST_HOME is the directory where transmission keeps its blocklists
END_DOC
BLOCKLIST_HOME=~/.config/transmission/blocklists
@raidzero
raidzero / gist:234480a144c3b8092c8ddcef76b4abd5
Created February 13, 2019 02:33
rudimentary raise command for swaymsg
diff --git a/include/sway/commands.h b/include/sway/commands.h
index 3ed00763..ae1e3f31 100644
--- a/include/sway/commands.h
+++ b/include/sway/commands.h
@@ -154,6 +154,7 @@ sway_cmd cmd_no_focus;
sway_cmd cmd_output;
sway_cmd cmd_permit;
sway_cmd cmd_popup_during_fullscreen;
+sway_cmd cmd_raise;
sway_cmd cmd_reject;
@raidzero
raidzero / untitled.scad
Created September 13, 2018 00:43
scad test
$fn = 50;
// distance between holes in the linear bearing
bearing_hole_distance = 18;
// diameter of the m4 holes in the linear bearing
bearing_hole_diameter = 3.9;
// how much space to the left and right of the holes
bearing_plate_padding = 2.5;
@raidzero
raidzero / base.scad
Created June 14, 2018 20:06
switch box scad design
// make a 75wx40dx25h hollow square
height = 25;
width = 75;
depth = 45;
thickness = 2;
// stereo jack/switch mounting holes
hole_diameter = 6;
// width of corner support columns
@raidzero
raidzero / musicwatcher.py
Last active April 29, 2018 20:28
hide/show windows on given workspace when focusing/unfocusing workspace
#!/usr/bin/env python
import i3ipc
import subprocess
# process all windows on this workspace. hide when leaving and show when entering
# because chrome/ium doesnt consider itself hidden when on an invisible workspace
# this script drops my cpu usage when listening to google music from ~10% to ~3%
MUSIC_WS_INDEX = 6
#include <stdio.h>
int main(void) {
FILE* fp = fopen("/proc/meminfo", "r");
if (fp != NULL) {
char buf[128];
int total, avail;
@raidzero
raidzero / rdump.py
Created March 5, 2014 23:31
Print all strings from android resources.arsc file
#!/usr/bin/python
import sys
DEBUG = False
HEADER_ONLY = False
if len(sys.argv) >= 2:
FILENAME = sys.argv[1]
if len(sys.argv) >= 3: