Skip to content

Instantly share code, notes, and snippets.

@TripleDogDare
TripleDogDare / vnc_install.sh
Last active June 14, 2023 05:32 — forked from x43x61x69/vnc_install.sh
Steam Deck VNC Installation
#!/bin/bash
#
# Script for installing x11vnc on Steam Deck.
#
# Install:
#
# This will modify root filesystem so it will probably get
# overwrite on system updates but is totally ok executing
# it several times, so if something stops working just
# launch it again.
@TripleDogDare
TripleDogDare / .serum debug cause.md
Last active December 30, 2022 18:19
serum debugging Cause method validation
We couldn’t find that file to show.
#!/bin/bash
set -euo pipefail
python3 -m venv venv
source ./venv/bin/activate
pip install jupyter numpy matplotlib pandas scipy control
@TripleDogDare
TripleDogDare / rewrite_ntfs_uuid.py
Created November 27, 2018 02:26
Generates and writes a new UUID for an NTFS partition. Used for disks from the same manufacturer that have the same UUID. This allows you to mount via UUID in /etc/fstab.
#!/usr/bin/env python3
# file: rewrite_ntfs_uuid.py
import sys
import random
import os
# partition file
fileName = sys.argv[1] # e.g. /dev/sdb1
UUID_OFFSET = 72 # location of NTFS UUID
@TripleDogDare
TripleDogDare / todo.md
Last active August 23, 2017 04:17
golang notes
  1. hash.Sum([]byte{}) does not do what I expected it to do. It prefixes the output with those bytes. I expected it to use it as a suffix for the hashing algorithm, but without actually affecting the underlying hash data. i.e. hash.Sum([]byte("foobar") -> "foobar<hash(written bytes)>" instead of "<hash(written bytes + "foobar">" https://play.golang.org/p/eCeUTlFCx4 Rereading the docs this makes sense now. But probably could use some additional examples.
@TripleDogDare
TripleDogDare / build.sh
Created August 15, 2017 23:00
statically linked builds of go binaries
CGO_ENABLED=0 GOOS=linux go build -a -ldflags '-extldflags "-static"' -tags netgo -installsuffix netgo main.go
CGO_ENABLED=0 GOOS=linux go build -a -ldflags '-extldflags "-static"' main.go
@TripleDogDare
TripleDogDare / gcpkubeconfig
Last active August 1, 2017 02:25
GCP kubernetes configuration/credentials fetching
#!/bin/bash
AUTH_LIST=$(gcloud --format=json auth list)
ACC_LIST=$(echo $AUTH_LIST | jq -r '.[].account')
if [ $(echo "${ACC_LIST}" | wc -l) -gt 1 ]; then
>&2 echo "Select account:"
select ACCOUNT in $(echo "${ACC_LIST}"); do
break
done
@TripleDogDare
TripleDogDare / fzgrep
Last active July 13, 2023 05:24
An interactive fuzzy grep showing surrounding context
#!/bin/bash
set -euo pipefail
# go get github.com/junegunn/fzf
BEFORE=10
AFTER=10
HEIGHT=$(expr $BEFORE + $AFTER + 3 ) # 2 lines for the preview box and 1 extra line fore the match
PREVIEW="$@ 2>&1 | grep --color=always -B${BEFORE} -A${AFTER} -F -- {}"
@TripleDogDare
TripleDogDare / go-dep-init.sh
Last active July 19, 2017 20:24
Greenfield project initializer using go dep tool
#!/bin/bash
set -euo pipefail
[ -z "${GOPATH:-}" ] && {
>&2 echo "GOPATH must be set"
exit 1
}
# FIXME: Make less specific to this project
PROJECT_PATH='github.com/tripledogdare'