Skip to content

Instantly share code, notes, and snippets.

@mrngm
mrngm / indexer_nyamsas.sh
Last active October 2, 2015 17:47
Indexer
$ cat indexer_nyamsas.sh
#!/bin/bash
if [ -r /home/mrngm/nyamsas_mount/index.gz ]; then
if [ -r /home/mrngm/nsas_idx ]; then
while true; do
DIFF=`zcat /home/mrngm/nyamsas_mount/index.gz | diff - /home/mrngm/nsas_idx | grep -i '<' > /tmp/tmp_idx_nyamsas`
STAT=$?
if [[ "$STAT" -eq "0" ]]; then
while read -r line; do
$ cat mariespul.sh
#!/bin/bash
#SERVER="loungemuziek"
SERVER="noordslet.science.ru.nl"
PORT="1337"
QUEUE=`echo 'LIST::QUEUE' | nc $SERVER $PORT`
NP=`echo 'LIST::NOWPLAYING' | nc $SERVER $PORT | cut -d ':' -f 3`
ALLNP=`echo 'LIST::ALL' | nc $SERVER $PORT | grep "SONG::$NP"`
@mrngm
mrngm / nat.sh
Last active June 23, 2023 09:52
#!/bin/bash
function print_help() {
echo "Easy 4-step NAT tool"
echo "Usage: $0 internal-dev external-dev ip-range"
echo ""
echo "internal-dev e.g. eth0"
echo "external-dev e.g. wlan0"
echo "ip-range e.g. 192.168.0.1/24"
}
@mrngm
mrngm / RaspBMC.conf
Created August 4, 2012 20:17
Modified XBMC.conf for Raspberry Pi, RaspBMC and PS3MediaServer
# ps3mediaserver renderer profile for xbox media center
# Refer to PS3.conf for help
RendererName=XBMC
RendererIcon=xbmc.png
# ============================================================================
# Identifying headers on Mac OS X:
# User-Agent: XBMC/10.0 r35648 (Mac OS X; 11.2.0 x86_64; http://www.xbmc.org)
# User-Agent: Platinum/0.5.3.0, DLNADOC/1.50
# ============================================================================
#!/bin/bash
#SERVER="loungemuziek"
SERVER="noordslet.science.ru.nl"
PORT="1337"
QUEUE=`echo 'LIST::QUEUE' | nc $SERVER $PORT`
NP=`echo 'LIST::NOWPLAYING' | nc $SERVER $PORT | cut -d ':' -f 3`
ALLNP=`echo 'LIST::ALL' | nc $SERVER $PORT | grep "SONG::$NP::"`
NUMQUEUE=`echo $QUEUE | cut -d ':' -f 3`
@mrngm
mrngm / dhcpleases.sh
Last active December 10, 2015 16:09
Fetches current DHCPACKs from syslog and formats it into a BIND-friendly format. This script takes into account the current leases already placed in DNS. (Use case: replace computer hostnames with (first|last|nick)names for easy recognition). Room for update: read the dhcpd.leases file.
#!/bin/bash
date
grep dhcpd /var/log/syslog | grep hostname | grep -i dhcpack | grep 'xx.yy' | grep -v 'xx.yy.zz.1' | sed -e 's/\(.*\)DHCPACK on \(.*\) to \(.*\)\( \(.*\)\|\) via vlanUU$/\2 \3 \4/' | grep -v 'hostname' | sort -u > currdhcpleases.txt
rm forwarddns.zone
rm reversedns.zone
while read IPADDR MAC HOST
@mrngm
mrngm / coftainer.py
Created March 23, 2013 20:35
Dirty implementation for coffee container
import tweepy
cons_key=""
cons_sec=""
acc_token=""
acc_sec_t=""
auth = tweepy.OAuthHandler(cons_key, cons_sec)
auth.set_access_token(acc_token, acc_sec_t)
# cat sciencevpn.sh
#!/bin/bash
ARGC=$#
if [[ "$ARGC" -lt "1" ]]; then
echo "Usage: $0 [on|off]"
exit 0;
fi
### GIT stuffs
function parse_git_dirty {
### git 1.8
[[ $(git status 2> /dev/null | tail -n1) != "nothing to commit, working directory clean" ]] && echo "*"
### git 1.7
# [[ $(git status 2> /dev/null | tail -n1) != "nothing to commit (working directory clean)" ]] && echo "*"
}
function parse_git_branch {
git branch --no-color 2> /dev/null | sed -e '/^[^*]/d' -e "s/* \(.*\)/[\1$(parse_git_dirty)]/"
@mrngm
mrngm / boom.sh
Last active December 31, 2015 08:19
Kerstboomscraper voor http://www.ru.nl/vm/kerstboom/
#!/bin/bash
set +H
GETIT='/usr/bin/wget -qO- http://communicatie.ruhosting.nl/kerstboom/active-entry2.php'
LASTMSG=`$GETIT | recode html..ascii`
while true; do
CMD=`$GETIT | recode html..ascii`