Skip to content

Instantly share code, notes, and snippets.

#include <stdio.h>
#include <stdlib.h>
#define _GNU_SOURCE
#include <getopt.h>
#define DEFAULT_LINES 5
static long get_nline(FILE *f);
static void do_tail(FILE *f, long nlines, long show_lines);
@poppen
poppen / fax2mail.sh
Created January 6, 2013 12:02
fax2mail.sh
#!/bin/sh
set -e
TIFF_FILE=$1
TO_ADDRESS=${2:-root}
CALLERID=${3:-anonymous}
FROM_ADDRESS="[email protected]"
if [ -f $TIFF_FILE ]; then
tiff2pdf $TIFF_FILE | uuencode fax.pdf | mailx -s "FAX from ${CALLERID}" $TO_ADDRESS
echo $((`date +%j`-`date -v-2w -v-sun +%j`))
#!/bin/sh
_DEBUG=0
function DEBUG()
{
if [ "$_DEBUG" -eq 1 ]; then
echo $@
else
eval $@
gdate -d 'sunday 2 weeks ago'
date -v-1w -v-sun
head -c 200 /dev/urandom | md5sum | sed -r 's/^(.{12}).*$/\1/; s/([0-9a-f]{2})/\1:/g; s/:$//;'
#!/bin/sh
wget --post-data="UPDATE_BUTTON=1" -O - http://ID:PASSWORD@IPADDR/index.cgi/reboot_main_set
#!/bin/sh
curl -d "UPDATE_BUTTON=1" http://ID:PASSWORD@IP_ADDRESS/index.cgi/reboot_main_set
if command -v lv > /dev/null; then export GIT_PAGER='lv -Ou8 -c'; fi
#!/bin/sh
trashdir=.recycle
rootdir=/var/lib/samba/shares
olddays=14
cd ${rootdir}
for targetdir in *; do
if [ -d ${targetdir}/${trashdir} ]; then