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 / 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 / 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 / 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 / strobe.bash
Last active May 9, 2018 19:21
TCP port scanner in Bash
#!/bin/bash
# strobe.bash
# Bash TCP/IP port scanner.
# http://www.catonmat.net/blog/tcp-port-scanner-in-bash/
# alarm() by Coder.C, scan() by Peteris Krumins, wrapped by Yesmar.
# Usage: strobe.bash <target> <protocol> <low[-high][,...]>
# You can specify 80 or 22,80 or 22,80,90-100,10000-25000,43001
@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 / apt-update.bash
Last active July 24, 2019 19:58
Update Ubuntu
#!/bin/bash
sudo bash -c 'apt-get update && apt-get -y dist-upgrade && apt-get -y autoremove --purge && apt-get -y autoclean'
@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 / 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 / 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"