Skip to content

Instantly share code, notes, and snippets.

View zxjinn's full-sized avatar

Kelvin Jasperson zxjinn

View GitHub Profile
@zxjinn
zxjinn / GregorianPalindrome.sh
Created December 18, 2012 20:58
quick and dirty way to brute force palindromes in the gregorian calendar using the format MM/DD/YYYY
#!/bin/bash
# quick and dirty way to brute force palindromes in the gregorian calendar
# using the format MM/DD/YYYY
MAX=5000000000000
i=0
while [ $i -ne $MAX ]
do
i=$[$i+1]
MONTHZ=$(date +%m --date "-${i} days")
@zxjinn
zxjinn / readwrite.sh
Created December 23, 2012 06:33
Simple read/write to ensure the file system is writeable. File to read/write is currently fixed, but contents are dynamic (uses $RANDOM). Designed to be used with Nagios.
#!/bin/bash
RANDOMFILE="/tmp/${RANDOM}-${RANDOM}-${RANDOM}.txt"
RANDOMCONTENTS="${RANDOM}${RANDOM}${RANDOM}"
export $SUVVESS="3"
function writeit()
{
touch $RANDOMFILE
echo -n $RANDOMCONTENTS > $RANDOMFILE
RETVAL=$?
@zxjinn
zxjinn / GenerateDiceware.sh
Created January 5, 2013 21:32
This is a way to generate a user-defined diceware passphrase list, instead of the one found at http://world.std.com/~reinhold/diceware.html. Only currently supports 5 dice. Tested on Ubuntu 12.04.
#!/bin/bash
DICTFN="/usr/share/dict/words"
NUMBERZ="1 2 3 4 5 6"
NUMDICE=5
WORDLIST=""
DICEARRAY=""
# TODO allow dynamic number of dice (up to a point, max size of dictfile)
@zxjinn
zxjinn / DirectoryUnzip.sh
Created January 18, 2013 06:09
Finds all zip files in the current directory, and its sub-directories, then unzips them into folders in the current directory that are named the same as the zip files and sub-directory names. For example: ./subdir/file.zip -> ./subdir_file/extractedfile. Tested on Ubuntu 12.04 with Unzip 6.00.
#!/bin/bash
# Extracts all zipfiles in subdirectories to current directory.
for source in $(find . -name "*.zip")
do
unzip -tq $source
retval=$?
if [ $retval -eq 0 ]
then
# ubuntu 12.04, assuming fresh install, still a work in progress
24 Feb 2013
###### as root user
# install pre-reqs
apt-get update
apt-get -y upgrade
apt-get -y dist-upgrade
apt-get -y install gcc g++ make cmake unzip subversion git-core gzip
OPTIONS * RTSP/1.0
CSeq: 1
User-Agent: AudioStation/3.1 (Synology)
================================
RTSP/1.0 200 OK
Audio-Jack-Status: connected; type=analog
CSeq: 1
Public: ANNOUNCE, SETUP, RECORD, PAUSE, FLUSH, TEARDOWN, OPTIONS, GET_PARAMETER, SET_PARAMETER
================================
ANNOUNCE rtsp://192.168.0.4/4166333301 RTSP/1.0
@zxjinn
zxjinn / RaspberryPiShairport.sh
Created March 20, 2013 03:40
From a new Raspian install to a working Shairport
# all as root
apt-get update
apt-get -y upgrade
apt-get -y install git libao-dev libssl-dev libcrypt-openssl-rsa-perl libio-socket-inet6-perl libwww-perl avahi-utils libmodule-build-perl
# Shairport pre-req
git clone https://github.com/njh/perl-net-sdp.git
cd perl-net-sdp
perl Build.PL
./Build
@zxjinn
zxjinn / Gemfile
Last active September 16, 2023 19:41
Ruby sunrise daemon
source 'https://rubygems.org'
gem 'daemons'
gem 'RubySunrise'
gem 'rufus-scheduler'
@zxjinn
zxjinn / listen.sh
Last active August 29, 2015 14:09
Line speed test
#!/bin/bash
# This is the case on Ubuntu
# TODO: Write checks for other OSes
which nc.traditional 1>&2> /dev/null
return_value=$?
if [ ${return_value} -ne 0 ]; then
echo "Traditional NC doesn't appear to be installed, please install 'netcat-traditional'"
exit 1
fi
@zxjinn
zxjinn / vip
Created February 20, 2015 16:30
AppleScript that pastes Symantec VIP code (used in Alfred Workflow)
to getCurrentApp()
return (path to frontmost application as text)
end getCurrentApp
on processCheck()
tell application "System Events" to get name of every process
if the result contains "VIP Access" then
activate application "VIP Access"
else
processCheck()