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 / colors.bash
Created July 24, 2019 13:27
Colorized output using tput(1)
#!/bin/bash
# ~/.local/etc/colors
# Wed Jan 21 19:04:30 PST 2015 yesmar@gmail.com
# Colorized output using tput(1). This script falls back to using ANSI escape
# codes if tput(1) is unavailable. All color names have been sourced from
# http://www.december.com/html/spec/colorhex.html
# shellcheck disable=SC2034
@yesmar
yesmar / pvs-inject-free.bash
Created October 29, 2020 15:03
Script to inject the license message required for free use of PVS-Studio
#!/bin/bash
# pvs-inject-free.bash 20180403 yesmar@gmail.com
# Use this script to inject the license message required for free use of
# PVS-Studio. https://github.com/viva64/how-to-use-pvs-studio-free is useful
# for adding these comments to your source files, but that program instruments
# static (i.e. pre-existing) source files. It doesn't work so well with
# dynamically generated files.
@yesmar
yesmar / tot.sh
Last active February 28, 2020 17:25 — forked from gruber/tot.sh
A shell script for Tot
#!/bin/bash
# Fork of Gruber's mod of CHOCK's original tot.sh that adds support for
# dot "0" to target the first empty dot. What's different? I fixed all
# the bugs identified by ShellCheck: https://www.shellcheck.net/
# https://gist.github.com/chockenberry/d33ef5b6e6da4a3e4aa9b07b093d3c23
basename=$(basename "$0")
if [ -z "$*" ]; then
@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 / keybase.md
Created April 27, 2019 18:03
Keybase

Keybase proof

I hereby claim:

  • I am yesmar on github.
  • I am yesmar (https://keybase.io/yesmar) on keybase.
  • I have a public key ASDdPz2UAqmjI2ykOJZsCSytbmev3Bzg6FSmKItOTQbw2Ao

To claim this, I am signing this object:

@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 / timestamp.js
Created February 14, 2018 06:36
ISO 8601 format timestamp suitable for use with JSON
const ingest = new Date()
console.log("\"" + ingest.toJSON() + "\"")
@yesmar
yesmar / fusbsd.bash
Created February 12, 2018 06:30
Create bootable USB installer for FreeBSD
#!/bin/bash
mkdir -p /tmp/freebsd && pushd !#:2
curl -#LO https://www.freebsd.org/releases/11.1R/CHECKSUM.SHA512-FreeBSD-11.1-RELEASE-amd64.asc
curl -#LO https://download.freebsd.org/ftp/releases/amd64/amd64/ISO-IMAGES/11.1/FreeBSD-11.1-RELEASE-amd64-memstick.img.xz
mkdir -p keyring && chmod 0700 !#:2
gpg --homedir=keyring --keyserver keyserver.ubuntu.com --recv-keys 8D12403C2E6CAB086CF64DA3031458A5478FE293
gpg --homedir=keyring --verify CHECKSUM.SHA512-FreeBSD-11.1-RELEASE-amd64.asc
grep FreeBSD-11.1-RELEASE-amd64-memstick.img.xz \
CHECKSUM.SHA512-FreeBSD-11.1-RELEASE-amd64.asc \
| awk '{ gsub("[()]",""); print $4 " " $2 }' \
@yesmar
yesmar / atv_vidslurp.rb
Created February 10, 2018 19:40
Pull down Apple's HD screensaver vids from Phobos
#!/usr/bin/env ruby
# atv_vidslurp.rb, 20161216 yesmar@gmail.com
# Pull down Apple's HD screensaver vids from Phobos.
require 'net/http'
require 'json'
PHOBOS_URL='http://a1.phobos.apple.com/us/r1000/000/Features/atv/AutumnResources/videos/entries.json'
@yesmar
yesmar / rootcheck.bash
Created February 2, 2018 03:19
Ensure script is running as root
#!/bin/bash
((EUID != 0)) && printf >&2 "This script should be run as root\\n" && exit 1