Skip to content

Instantly share code, notes, and snippets.

@joshenders
joshenders / pesar_guy.md
Last active August 29, 2015 13:56
pesar_guy is a scammer

From: pesar_guy
Sent: Jan-06-14 05:26 PM

Can you send it to 21500 Burbank Blvd Apt 206 Woodland hills CA 91367 thanks

From: joshenders

@joshenders
joshenders / offline.sh
Last active August 29, 2015 13:56
bash function to offline an arbitrary scsi device
function offline() {
if [[ "$EUID" -ne '0' ]]; then
echo "This function requires root privileges"
return 1
elif [[ "$#" -ne '1' ]]; then
echo "Usage: $FUNCNAME <device node>"
return 1
fi
# basename
@joshenders
joshenders / start.sh
Created February 28, 2014 20:49
plexmediaserver's primitive start.sh script
#!/bin/sh
#SCRIPTPATH=$(dirname $(python -c 'import sys,os;print os.path.realpath(sys.argv[1])' $0))
SCRIPT=$(readlink -f $0)
SCRIPTPATH=`dirname ${SCRIPT}`
export LD_LIBRARY_PATH="${SCRIPTPATH}"
export PLEX_MEDIA_SERVER_HOME="${SCRIPTPATH}"
export PLEX_MEDIA_SERVER_MAX_PLUGIN_PROCS=6
export LC_ALL="en_US.UTF-8"
export LANG="en_US.UTF-8"
ulimit -s 3000

Keybase proof

I hereby claim:

  • I am joshenders on github.
  • I am joshenders (https://keybase.io/joshenders) on keybase.
  • I have a public key whose fingerprint is 2FA2 9C3D 3D16 E8E6 B841 E926 C1F0 A6E2 7139 3C70

To claim this, I am signing this object:

#!/usr/bin/env python2
# Quick and dirty demonstration of CVE-2014-0160 by Jared Stafford (jspenguin@jspenguin.org)
# The author disclaims copyright to this source code.
import sys
import struct
import socket
import time
import select
@joshenders
joshenders / ddns-update.sh
Last active August 29, 2015 14:01
afraid.org DDNS updater
#/bin/bash
# Cron every 10 minutes:
# 0,10,20,30,40,50 * * * * /usr/local/sbin/ddns-update
#
# For logging:
# $ mkdir /var/log/ddns-update
# $ cat << EOF > /etc/logrotate.d/ddns-update
# /var/log/ddns-update.log {
# rotate 3
@joshenders
joshenders / 02periodic
Last active August 29, 2015 14:01
/etc/apt/apt.conf.d/02periodic
// This file sets apt configuration variables for /etc/cron.daily/apt
// Values here are the default
// RootDir for all configuration files
// Dir "/";
// Set apt package cache directory
// Dir::Cache "var/cache/apt/";
// Set package archive directory
#!/bin/sh
#
# Originally found here: http://jenders.vox.com/library/post/macports-workaround-for-installing-distcc-31-on-an-intel-mac.html
#
makefile=/opt/local/var/macports/sources/rsync.macports.org/release/ports/devel/distcc/work/distcc-3.1/Makefile
if test -e $makefile; then # user has a half completed installation
break
function npr() {
# Usage: npr
# autoplays NPR radio stream
local day="$(date '+%A')"
local date="$(date '+%m-%d-%Y')"
case ${day} in
Sunday)
local program='10'
;;
@joshenders
joshenders / shell_test.sh
Created December 19, 2014 06:39
shell_test
#!/bin/bash
# by Dennis Williamson
# 2010-10-06, revised 2010-11-10
# for http://stackoverflow.com/questions/3869072/test-for-non-zero-length-string-in-bash-n-var-or-var
# designed to fit an 80 character terminal
dw=5 # description column width
w=6 # table column width
t () { printf "%-${w}s" "true"; }