Skip to content

Instantly share code, notes, and snippets.

View chuckwagoncomputing's full-sized avatar

David Holdeman chuckwagoncomputing

View GitHub Profile
@chuckwagoncomputing
chuckwagoncomputing / calendar.go
Created November 19, 2021 23:12
Calendar Generator
package main
import (
"os"
"fmt"
"time"
)
func main () {
year := 2022
@chuckwagoncomputing
chuckwagoncomputing / hotplug.sh
Created January 1, 2021 04:27
Graphically un-hotplug drives
#!/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 September 12, 2018 16:57
Brute forcer in go. Tries given dictionary first.
package main
import (
"bufio"
"fmt"
"os"
"time"
)
func main() {
@chuckwagoncomputing
chuckwagoncomputing / vcd.sh
Created February 7, 2018 21:56
Script to convert postgres table to vcard
#!/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 February 8, 2018 19:24
LibreOffice macro to parse vcard data
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 February 13, 2017 21:21 — forked from mimosz/nginx.conf
nginx + unicorn + padrino on ubuntu
# 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 March 21, 2020 18:45 — 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)
##########
# Win10 Initial Setup Script
# Author: Disassembler <[email protected]>
# 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 December 27, 2016 04:09
A function to get fractional age for my conky
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 December 14, 2016 17:24
FOAC Strategy: qualitativeThree, now with a preference for the person called by the first person on the couch.
# 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 November 23, 2016 19:04
How much more likely are you to roll 6 dice uniquely than all the same?
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]