Skip to content

Instantly share code, notes, and snippets.

View bahamat's full-sized avatar
☁️

Brianna Bennett bahamat

☁️
View GitHub Profile
@bahamat
bahamat / make-bootable-image.sh
Created March 8, 2023 21:10 — forked from oetiker/make-bootable-image.sh
How to create a bootable disk image that works with bios and uefi
#!/bin/sh
# apt install gdisk syslinux syslinux-efi mtools
IMG=boot-image.img
SIZE=300
KERNEL=vmlinz
INITRAMFS=initrd.img
MD="mmd -i ${IMG}@@1M"
CP="mcopy -i ${IMG}@@1M"
RN="mren -i ${IMG}@@1M"
dd if=/dev/zero bs=1M count=$SIZE of=$IMG
@bahamat
bahamat / dnsupdate.py
Created July 27, 2019 09:09 — forked from pklaus/dnsupdate.py
dnsupdate is meant to replace nsupdate, the standard DDNS update tool created by BIND authors ISC. While nsupdate does the job it is awkward to wrap in scripts and its usage in general is just not very intuitive. dnsupdate is meant to work well from the command line or from scripts and easy to use. It also does some nice things like automaticall…
#!/usr/bin/env python2.7
# Matt's DNS management tool
# Manage DNS using DDNS features
#
# See http://planetfoo.org/blog/archive/2012/01/24/a-better-nsupdate/
#
# Usage: dnsupdate -s server -k key -t ttl add _minecraft._tcp.mc.example.com SRV 0 0 25566 mc.example.com.
# -h HELP!
# -s the server
# -k the key
#!/bin/bash
# This little hack-job will grab credentials from a running openvpn process in Linux
# Keep in mind this won't work if the user used the --auth-nocache flag
grep rw-p /proc/$1/maps | sed -n 's/^\([0-9a-f]*\)-\([0-9a-f]*\) .*$/\1 \2/p' | while read start stop; do gdb --batch-silent --silent --pid $1 -ex "dump memory $1-$start-$stop.dump 0x$start 0x$stop"; done
echo "Your credentials should be listed below as username/password"
strings *.dump | grep -B2 KnOQ | grep -v KnOQ
rm *.dump --force
@bahamat
bahamat / Makefile
Last active October 12, 2016 19:13 — forked from isaacs/Makefile
# Hello, and welcome to makefile basics.
#
# You will learn why `make` is so great, and why, despite its "weird" syntax,
# it is actually a highly expressive, efficient, and powerful way to build
# programs.
#
# Once you're done here, go to
# http://www.gnu.org/software/make/manual/make.html
# to learn SOOOO much more.
@bahamat
bahamat / quine.js
Last active August 29, 2015 14:19 — forked from bahamas10/quine.js
#!/usr/bin/env node
var util = require("util");
var source = [
'#!/usr/bin/env node',
'',
'var util = require("util");',
'',
'var source = [',
@bahamat
bahamat / quine.bash
Last active August 29, 2015 14:19 — forked from bahamas10/quine.bash
#!/usr/bin/env bash
s=(
'#!/usr/bin/env bash'
''
's=('
')'
''
'q=$(printf "\x27")'
'for ((i = 0; i < 3; i++ )); do'
@bahamat
bahamat / gist:c154b59ea1c5710e141c
Last active December 20, 2020 01:06 — forked from bdha/gist:c456cf6e5484ea5ad256
haskell ghc on smartos
@bahamat
bahamat / gist:7c4abade72d674e34281
Last active December 20, 2020 01:05
Magical quoting with printf %q
$ echo quote what? ; read quoteme ; printf %q "$quoteme" ; echo
quote what?
The horse said "$)#*@(!!%" when he stubbed his hoof.
The\ horse\ said\ \"\$\)#\*@\(\!\!%\"\ when\ he\ stubbed\ his\ hoof.
$
/*
* This is free and unencumbered software released into the public domain.
*
* Anyone is free to copy, modify, publish, use, compile, sell, or
* distribute this software, either in source code form or as a compiled
* binary, for any purpose, commercial or non-commercial, and by any
* means.
*
* In jurisdictions that recognize copyright laws, the author or authors
* of this software dedicate any and all copyright interest in the