Skip to content

Instantly share code, notes, and snippets.

@Sulter
Sulter / findHF.lua
Last active January 7, 2020 18:52
Find historical figure in Dwarf Fortress using DFhack
-- Locates a historical figure (HF) on the world map.
-- Pass any part of the unit's (translated or native) name as an argument to the script.
-- The script will print out the current location of the historical figure, whatever it is traveling the world, or inside a site
local function matchName(searchName, nameObj)
translated = dfhack.TranslateName(nameObj, true)
notTranslated = dfhack.TranslateName(nameObj, false)
searchName = string.lower(searchName)
if string.match(string.lower(translated), searchName) then
return translated
@Sulter
Sulter / ddWriteAndCheck.sh
Created January 6, 2018 22:22
copies .img onto block device and cheks for errors (md5sum comparison).
#!/bin/sh
usage="$(basename "$0") [-h] [-i path] [-o path]
copies .img onto block device and cheks for errors (md5sum comparison).
where:
-h show this help text
-i path to .img (i.e. /home/debian.img)
-o path to blk device (i.e. /dev/sda etc.)
"
@Sulter
Sulter / gps.sh
Created November 7, 2017 15:17
gps calc functions
#DMS to DD
echo "56 14 21.01735" | awk '{printf ("%.10f\n", $1+$2/60.00+$3/3600.00)}'
#distance between two DD points
@Sulter
Sulter / ddCheck.sh
Created October 30, 2017 15:40
checks if there were no errors doing dd to a block device
#!/bin/sh
usage="$(basename "$0") [-h] [-i path] [-o path]
md5sum comparison of .img and a block device.
where:
-h show this help text
-i path to .img (i.e. /home/debian.img)
-o path to blk device (i.e. /dev/sda etc.)
"
@Sulter
Sulter / movementDetector.py
Created October 22, 2017 10:29
Designed for surveillance over long periods of time
"""
TODO:
* only do caclulation if cooldown is finished
* make directory (opencv doesn't cast exceptions on write errors)
* sort from biggest to smallest area, and save the image with the biggest detection area of that frame shown.
"""
import argparse
import datetime
import time
import cv2
@Sulter
Sulter / piDetection.py
Created October 22, 2017 09:54
simple CV based detection for raspberry pi
# import the necessary packages
import argparse
import datetime
import time
import cv2
from picamera.array import PiRGBArray
from picamera import PiCamera
# construct the argument parser and parse the arguments
ap = argparse.ArgumentParser()
#!/bin/bash
if [ -z "$1" ]
then
FILE=main.elf
else
FILE=$1
fi
TOTAL_ROM=1000000
@Sulter
Sulter / .bashrc
Last active September 24, 2016 16:36
function findString { grep --color=always -rn $1 -e "$2"; }
export -f findString
#file extractor
extract ()
{
if [ -f $1 ] ; then
case $1 in
*.tar.bz2) tar xvjf $1;;
*.tar.xz) tar xvJf $1;;
@Sulter
Sulter / readme
Last active January 14, 2023 17:00
screen+zmodem sending data
lrzsz package needed (debian) which include sz and rz
Sending from remote -> local
* screen into remote
* ctrl-a : zmodem catch
* 'sz filename' on the remote (in terminal)
Sending from local -> remote
* screen into remote
* ctrl-a : zmodem catch
@Sulter
Sulter / lxterminal.conf
Created December 17, 2014 20:42
lxpanel settings
[general]
fontname=Monospace 11
selchars=-A-Za-z0-9,./?%&#:_
scrollback=5000
bgcolor=#000000000000
bgalpha=65535
fgcolor=#ffffffffffff
disallowbold=false
cursorblinks=false
cursorunderline=false