Skip to content

Instantly share code, notes, and snippets.

@seakintruth
seakintruth / connector.scad
Created February 27, 2023 13:56 — forked from BarDweller/connector.scad
Configurable Tent pole coupler in OpenSCAD
// This is an example of connecting poles from
// https://gist.github.com/BarDweller/f467cb58f5c252efda60eaa6777309ca
poleradius = 9/2; //radius of pole
socketdepth = 15; //depth required for pole socket (note: not absolute due to ball join)
totalplugsize = 20; //exterior depth of pole corner
wallthick = 2; //thickness for walls
joinangle = 120; //angle to join two connectors at.
smoothness = 64; //number of faces for cylinder/sphere.
@seakintruth
seakintruth / PressLocks.ps1
Last active December 11, 2022 19:15
Powershell Keep Alive Smash Lock Keys
# This can be found/tracked at this public GIST:
# https://gist.github.com/seakintruth/ab55e008d6bdda78c97d7d1a124d93b0
# Modified from These:
# https://gist.github.com/MatthewSteeples/ce7114b4d3488fc49b6a?permalink_comment_id=3682064
# https://stackoverflow.com/a/15846912
$defaultNumLockStateOff = $false
$defaultScrollLockStateOff = $true
$defaultCapsLockStateOff = $true
@seakintruth
seakintruth / ini.ps1
Last active June 23, 2023 04:55 — forked from beruic/ini.ps1
Read INI files in PowerShell
function Get-IniFile {
<#
.SYNOPSIS
Read an ini file.
.DESCRIPTION
Reads an ini file into a hash table of sections with keys and values.
.PARAMETER filePath
The path to the INI file.
@seakintruth
seakintruth / download_fist_chunk_mp4.py
Created January 20, 2022 18:17
Download just the first chunk of an mp4 file to test that the url contains something.
import requests
# From https://stackoverflow.com/a/28374584
def downloadfile(name,url):
name=name+".mp4"
r=requests.get(url)
print("****Connected****")
f=open(name,'wb');
print("Downloading.....")
for chunk in r.iter_content(chunk_size=255):
@seakintruth
seakintruth / compress_folder.sh
Last active September 21, 2021 03:13
Bash script to compress a folder with screen
#!/usr/bin/env bash
# using template from: https://betterdev.blog/minimal-safe-bash-script-template/
set -Eeuo pipefail
trap cleanup SIGINT SIGTERM ERR EXIT
script_dir=$(cd "$(dirname "${BASH_SOURCE[0]}")" &>/dev/null && pwd -P)
usage() {
cat <<EOF
Usage: $(basename "${BASH_SOURCE[0]}") [-h] [-v] [-f || --folder_name] "a folder name"
@seakintruth
seakintruth / TcltkBasedCountDownTimer.R
Last active August 10, 2022 13:39
This R countdown timer draws from three different discussions and code solutions from arround the web.
#!/usr/bin/env Rscript
if (!require("pacman")) install.packages("pacman")
pacman::p_load(tcltk)
# From: https://gist.githubusercontent.com/jbryer/3342915/raw/07cede2640889d82944e604be6a4840a964a1a58/varEntryDialog.r
#' Creates a dialog box using tcl/tk to get input from the user.
#'
#' This function will create a tcl/tk dialog box to get user input. It has been
#' written to be extensible so the R programmer can easily create a dialog with
#' any number of varaibles with custom labels and data conversion of the user
@seakintruth
seakintruth / namecheap_dynamic_dns.sh
Last active July 21, 2021 17:31
namecheap bash script to submit dynamic dns from several possible public ip address services
#!/usr/bin/env bash
# set log path
LogPath=/data/logs/crontab/dynamic_dns.txt
echo "---------------------------------" >> $LogPath
date -u >> $LogPath
echo "---------------------------------" >> $LogPath
# get this machine's public IP address from a service
# [TODO] currently only icanhazip is working, need to check the syntax of the others
remoteIp=$(curl ifconfig.me)
@seakintruth
seakintruth / get_pretty_timestamp_diff.R
Created May 27, 2021 02:45
Get a pretty display from two timestamps (diff of seconds)
get_pretty_timestamp_diff <- function(
start_timestamp,
end_timestamp,
seconds_decimal=2,
round_simple=TRUE
){
# Set defaults
.days_decimal <- 0
.days <- 0
.hours_decimal <- 0
def extractDomain(data):
# Remove protocol part of url
data = re.sub(r"^http(s)?\x3a\x2f\x2f", "", str(data), flags=re.IGNORECASE)
# Remove part after FQDN
data = re.sub(r"\x2f(.*)$", "", str(data), flags=re.IGNORECASE)
# Remove port
data = re.sub(r"\x3a\d{1,}$", "", str(data), flags=re.IGNORECASE)
@seakintruth
seakintruth / func_TimeStampEpoch.bas
Last active February 26, 2021 20:45
Visual Basic Epoch Time Handling
'Notes: Visual Basic (VBScript, or VBA) to handle UNIX like Epoch Timestamps with timezone corrections to UTC
' TimeStampEpoch, and date2epoch functions return epoch as fracional decimal values in seconds since epoch
'Maintained at:https://gist.github.com/seakintruth/ddcc3d5e400a5083458494ae30d55466
'Dependencies: Windows with "WbemScripting.SWbemDateTime", a default 32bit app
'Contributing: Jeremy D. Gerdes<seakintruth@gmail.com>, https://stackoverflow.com/a/22842128
'License: CC-BY-SA 3.0
'Version: 1.0.6
Function TimeStampEpoch()
'Returns a time stamp in the format of seconds since epoch
' Use this when you need epoch values, from testing, calling Timer() is roughly 10 times faster than calling TimeStampEpoch