Skip to content

Instantly share code, notes, and snippets.

@daktak
daktak / getwebshot.sh
Last active December 30, 2018 22:38
Take a photo from the webcam and email it. Requires sendmail and mplayer
#!/bin/sh
#edit /etc/pam.d/system-auth
#change pam_unix (line 2 to below)
#auth [success=1 new_authtok_reqd=ok ignore=ignore default=bad] pam_unix.so try_first_pass likeauth nullok
#auth [default=ignore] pam_exec.so seteuid /usr/local/bin/getwebshot.sh
TMP_DIR=/tmp/cheese
HOSTNAME=localhost
MAILTO=me@email.com
MAILFROM=root@email.com.au
SUBJECT="Do you know this person?"
@daktak
daktak / vcftoxml.py
Created May 7, 2015 04:04
convert Contacts.vcf to XML format used by Pidgin (good for Whatsapp / Telegram contact list)
#!/usr/bin/env python
"""
Parse phone and email records out of vCard file and store them in an xml file to
be inserted into pidgins blist.xml.
Copyright (C) 2012 Senko Rasic <senko.rasic@dobarkod.hr>
Permission is hereby granted, free of charge, to any person obtaining a copy of
this software and associated documentation files (the "Software"), to deal in
@daktak
daktak / MoveFiles.py
Last active February 3, 2018 01:06
NZBGet script to move nzb files into watch dir
#!/usr/bin/env python2
# GistID: 581f5a91899f5662a4a8
#
# Move files post-processing script for NZBGet
#
# Copyright (C) 2013 Andrey Prygunkov <hugbug@users.sourceforge.net>
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
@daktak
daktak / dvd2xvid.sh
Created January 17, 2013 00:54
Single pass DVD to xvid
#! /bin/bash
## Usage: dvdiso2xvid.sh file.iso
## http://www.howforge.com/how-to-encode-dvd-to-avi-using-mencoder
## http://forum.videohelp.com/threads/288190-(SOLVED)-Need-mencoder-help-certain-files-have-no-audio
for file in "$@"
do
bn=`basename "$file"`
NameNoExt=${bn%.*} ## no extension
mencoder dvd://1 -dvd-device "$bn" -oac mp3lame -lameopts mode=2:cbr:br=128:vol=0 -ovc xvid -xvidencopts bitrate=-1 -vf scale -zoom -xy 480 -o "$NameNoExt.avi"
@daktak
daktak / qvm-talk.sh
Last active January 9, 2017 05:15
Qubes-OS allow two appvms to talk to each other
#!/bin/bash
vm1=$1
vm2=$2
fw=$3
ip1=`qvm-run -p -u root ${vm1} "ifconfig eth0 | grep 'inet ' | column -t | cut -d ' ' -f3"`
ip2=`qvm-run -p -u root ${vm2} "ifconfig eth0 | grep 'inet ' | column -t | cut -d ' ' -f3"`
if [ -z ${fw} ]; then
fw=sys-firewall
fi
#!/bin/sh
# script to check for complete torrents in transmission folder, then stop and move them
# either hard-code the MOVEDIR variable here?
MOVEDIR=/pub/sabnzbd/complete # the folder to move completed downloads to
IP=192.168.5.90
# ?or set MOVEDIR using the first command-line argument
# MOVEDIR=%1
# use transmission-remote to get torrent list from transmission-remote list
# use sed to delete first / last line of output, and remove leading spaces
@daktak
daktak / ng-iprules.sh
Last active March 12, 2016 21:02
Transparent Proxy mangle for NetGear router
#!/usr/bin/expect
set timeout 20
set hostName [lindex $argv 0]
set userName [lindex $argv 1]
set password [lindex $argv 2]
spawn telnet $hostName
expect "DGN2200v3 login: "
send "$userName\r"
@daktak
daktak / mylarToKindle.sh
Last active January 3, 2016 04:58
post processing script for Mylar (after)
#!/bin/bash
#mylar post processing
#
CALIBRE_PATH=/usr/bin
EXPECTED_ARGS=5
PORT="25"
SERVER="localhost"
ENCRYPTION_METHOD="NONE"
KINDLE_EMAIL="user@kindle.com"
FROM_EMAIL="user@email
@daktak
daktak / newsToKindle.sh
Last active January 3, 2016 02:09
Push a Calibre recipe to your Kindle
#!/bin/bash
DOWNLOAD_DIRECTORY="/pub/sabnzbd/books"
CALIBRE_PATH=/usr/bin
PORT="25"
SERVER="localhost"
ENCRYPTION_METHOD="NONE"
KINDLE_EMAIL="kindle_user@kindle.com"
FROM_EMAIL="authorized@email.com"
PROFILE="kindle_pw"
TODAY=`date --date="now" +%d/%m/%y`
@daktak
daktak / vcf-gpg-import.sh
Created August 21, 2013 06:03
Check for GPG keys for a given contact vcf file
#!/bin/bash
for n in `cat $1 | grep @ | sed 's/.*://'| sed 's/\r//'`; do gpg --keyserver pgp.mit.edu --search-keys $n; done