Skip to content

Instantly share code, notes, and snippets.

View yesmar's full-sized avatar
💭
Another Fine Product From The Nonsense Factory

ɹɐɯsǝʎ yesmar

💭
Another Fine Product From The Nonsense Factory
  • /dev/funk
View GitHub Profile
@yesmar
yesmar / burn.c
Created December 8, 2017 22:27
Secure in-memory string erasure
/*
* burn.c
* Secure in-memory string erasure
*
* This is a modified version of the code originally posted to the
* Cryptograhy ML by Werner Koch:
* https://www.mail-archive.com/cryptography@metzdowd.com/msg08428.html
*
* By default, modern C compilers will pick up and use the static inline
* function. However, if you prefer your C to be pre-C99, compile with
@yesmar
yesmar / git-email-prompt.bash
Last active December 19, 2017 04:10
Bash prompt that asks for email address to configure for git repository
#!/bin/bash
# git-email-prompt.bash yesmar@gmail.com
# Bash prompt that asks for email address to configure for git repository.
# This is a modified version of the script originally created by
# [Marvin Frommhold](http://depressiverobot.com/2015/01/05/git-email.html).
# I have extracted the hardcoded email addresses out of script. Create a
# ~/.gitmails file and put your email addresses in there. The content of the
# file should look like:
@yesmar
yesmar / argon2.go
Created December 22, 2017 18:59
Key derivation using Argon2
// https://godoc.org/golang.org/x/crypto/argon2
package main
import (
"crypto/rand"
"encoding/hex"
"fmt"
"golang.org/x/crypto/argon2"
@yesmar
yesmar / hexdump.go
Last active December 22, 2017 19:01
No frills hex dump
package main
import (
"fmt"
)
// HexDump the specified byte slice.
func HexDump(bs []byte, width int) {
for i, v := range bs {
fmt.Printf("%02x ", v)
@yesmar
yesmar / precip.bash
Created January 26, 2018 23:44
Mainly it snows, but sometimes it rains knives…
#!/bin/bash
case $((RANDOM % 4)) in
1) precip=🔪 ;;
*) precip=❄️ ;;
esac
lines=$(tput lines)
columns=$(tput cols)
@yesmar
yesmar / insult.bash
Last active January 27, 2018 00:51
Jasonius insult generator
#!/bin/bash
# insult.bash: insult generator inspired by a picture I saw on Imgur
# Copyright © 2016, Ramsey Dow. All rights reserved.
# SPDX-License-Identifier: BSD-2-Clause
shopt -s extglob
declare -a alpha=(lazy stupid insecure idiotic slimy slutty smelly
pompous communist dicknose pie-eating racist elitist 'white trash'
drug-loving butterface 'tone deaf' ugly creepy
@yesmar
yesmar / gknox.bash
Last active January 27, 2018 00:52
Encrypted disk image on/off switch for macOS
#!/bin/bash
# gknox.bash: encrypted disk image on/off switch for macOS
# Copyright © 2015,2017, Ramsey Dow. All rights reserved.
# SPDX-License-Identifier: BSD-2-Clause
PERSONAL_BIN=~/.local/bin
PATH=${PERSONAL_BIN}:/bin:/usr/bin:/usr/sbin
script=$(basename "$0")
@yesmar
yesmar / dupes.rb
Last active January 27, 2018 00:55
Ruby script to find and remove duplicate files
#!/usr/bin/env ruby
# dupes.rb — Given one or more target directories, identify duplicate files through
# cryptographic hashing. The exit status is the number of duplicates identified.
# Copyright © 2016,2017, Ramsey Dow. All rights reserved.
# SPDX-License-Identifier: BSD-2-Clause
# 20160811 yesmar@gmail.com
# 20160822 added color output and deletion support
@yesmar
yesmar / showdefines.bash
Last active January 27, 2018 00:59
Display default compiler symbols
#!/bin/bash
# showdefines.bash: display default compiler symbols.
# Copyright © 2011,2017, Ramsey Dow. All rights reserved.
# SPDX-License-Identifier: BSD-2-Clause
# Usage: showdefines.bash [-c compiler] [-l language] [additional flags ...]
# Defaults to clang++, but works fine with C and groks the GNU and Intel compilers, as well.
# http://clang.llvm.org/
@yesmar
yesmar / aapl_slurp.rb
Last active January 27, 2018 01:01
Bulk downloader for Apple open source projects
#!/usr/bin/env ruby
# aapl_slurp.rb: downloader for Apple open source projects
# Copyright © 2017, Ramsey Dow. All rights reserved.
# SPDX-License-Identifier: BSD-2-Clause
# mkdir /tmp/macOS-1013 && pushd !#:1
# curl -#LO https://opensource.apple.com/plist/macos-1013.plist
# SSL_CERT_FILE=$CURL_CA_BUNDLE ruby /path/to/aapl_slurp.rb macos-1013.plist