Skip to content

Instantly share code, notes, and snippets.

Avatar

David Holdeman chuckwagoncomputing

View GitHub Profile
@chuckwagoncomputing
chuckwagoncomputing / hotplug.sh
Created Jan 1, 2021
Graphically un-hotplug drives
View hotplug.sh
#!/usr/bin/env bash
LINE=""
DRIVES=$(ls /sys/block)
for DRIVE in $DRIVES; do
if ls /dev/$DRIVE 2>/dev/null >/dev/null && ls /sys/block/$DRIVE/device/delete 2>/dev/null >/dev/null; then
SIZE=$(blockdev --getsize64 /dev/$DRIVE | awk '{ split( "B KB MB GB TB" , v ); s=1; while( $1>1024 ){ $1/=1024; s++ } print int($1) v[s] }')
LINE="$LINE p $DRIVE $SIZE"
fi
done
BLOCK=$(zenity --list --title "Choose drive to remove" --radiolist --column="Remove" --column="Device" --column="Size" $LINE)
@chuckwagoncomputing
chuckwagoncomputing / brute.go
Created Sep 12, 2018
Brute forcer in go. Tries given dictionary first.
View brute.go
package main
import (
"bufio"
"fmt"
"os"
"time"
)
func main() {
@chuckwagoncomputing
chuckwagoncomputing / vcd.sh
Created Feb 7, 2018
Script to convert postgres table to vcard
View vcd.sh
#!/usr/bin/env bash
I=0
while read t; do
I=$((I+1))
ID=$(echo $t | cut -d "|" -f 1 | xargs)
FIRST=$(echo $t | cut -d "|" -f 2 | xargs)
LAST=$(echo $t | cut -d "|" -f 3 | xargs)
ADDRESS=$(echo $t | cut -d "|" -f 4 | xargs)
CITY=$(echo $t | cut -d "|" -f 5 | xargs)
STATE=$(echo $t | cut -d "|" -f 6 | xargs)
@chuckwagoncomputing
chuckwagoncomputing / vcardparse.js
Last active Feb 8, 2018
LibreOffice macro to parse vcard data
View vcardparse.js
importClass(Packages.com.sun.star.uno.UnoRuntime);
importClass(Packages.com.sun.star.sheet.XSpreadsheetDocument);
importClass(Packages.com.sun.star.container.XIndexAccess);
importClass(Packages.com.sun.star.table.XCellRange);
importClass(Packages.com.sun.star.table.XCell);
importClass(Packages.com.sun.star.text.XText);
function parseAddress(addr) {
var raddr = addr.split(" ").reverse();
var ret = {zip: raddr[0], state: raddr[1], city: raddr[2], street: ""};
@chuckwagoncomputing
chuckwagoncomputing / nginx.conf
Last active Feb 13, 2017 — forked from mimosz/nginx.conf
nginx + unicorn + padrino on ubuntu
View nginx.conf
# sudo ln -s ~/nginx.conf unicorn.conf
upstream app_server {
server unix:/tmp/unicorn_padrino.sock fail_timeout=0;
}
server {
listen 80;
charset utf-8;
server_name db.innshine.com;
@chuckwagoncomputing
chuckwagoncomputing / reclaimWindows10.ps1
Last active Mar 21, 2020 — forked from alirobe/reclaimWindows10.ps1
"Reclaim Windows 10" turns off a bunch of unnecessary Windows 10 telemetery, removes bloatware, and privacy invasions. Review and tweak before running. Scripts for reversing are included and commented. Fork via https://github.com/Disassembler0 (different defaults)
View reclaimWindows10.ps1
##########
# Win10 Initial Setup Script
# Author: Disassembler <disassembler@dasm.cz>
# Version: 1.7, 2016-08-15
# dasm's script: https://github.com/Disassembler0/Win10-Initial-Setup-Script/
# THIS IS A PERSONALIZED VERSION
# This script leaves more MS defaults on, including MS security features.
# Tweaked based on personal preferences for @alirobe 2016-11-16 - v1.7.1
@chuckwagoncomputing
chuckwagoncomputing / age.lua
Created Dec 27, 2016
A function to get fractional age for my conky
View age.lua
function conky_get_age(year, month, day)
if conky_window == nil then
return
end
daystoday = os.date("%j")
daysatbirth = os.date("%j", os.time{year=year, month=month, day=day})
yearsold = os.date("%Y") - os.date("%Y", os.time{year=year, month=month, day=day})
if daysatbirth > daystoday then
yearsold = math.floor(yearsold - 1)
dayssince = (365 - daysatbirth) + daystoday
@chuckwagoncomputing
chuckwagoncomputing / qualitativeThreeCouchCaller.rb
Last active Dec 14, 2016
FOAC Strategy: qualitativeThree, now with a preference for the person called by the first person on the couch.
View qualitativeThreeCouchCaller.rb
# Keep track of who has three pseudonyms, forgetting one in order to remember a better one
class StrategyqualitativeThreeCouchCaller
def initialize(parent)
@strategy = parent
@player = @strategy.player
@memory = @strategy.memory
end
def remember(calledName, calledTeam, calledPosition, calledPseudonym, callerName)
# if someone called a number being remembered
@chuckwagoncomputing
chuckwagoncomputing / greed.rb
Created Nov 23, 2016
How much more likely are you to roll 6 dice uniquely than all the same?
View greed.rb
greed = 0
flush = 0
10000000.times do
dice = []
6.times do
dice.push((1..6).to_a.sample)
end
if dice.include?(1) and dice.include?(2) and dice.include?(3) and dice.include?(4) and dice.include?(5) and dice.include?(6)
greed += 1
elsif dice[0] == dice[1] and dice[1] == dice[2] and dice[2] == dice[3] and dice[3] == dice[4] and dice[4] == dice[5]
@chuckwagoncomputing
chuckwagoncomputing / main.c
Last active Oct 27, 2018
Bobcat 225G welder idle controller
View main.c
//*****************************************************//
// welder.c //
// 2016-4-11 //
// Written By David Holdeman //
// Miller Bobcat 225G Idle Solenoid Controller //
//*****************************************************//
// ATtiny45/85
// +-------+
// !RESET |* | VCC
You can’t perform that action at this time.