Skip to content

Instantly share code, notes, and snippets.

View rdmarsh's full-sized avatar

David Marsh rdmarsh

View GitHub Profile
@rdmarsh
rdmarsh / salt-ssh no hosts found.md
Last active December 1, 2015 09:11
How to fix "No hosts found with target * of type glob" for salt-ssh

If you get this error when running sudo salt-ssh '*' test.ping:

"No hosts found with target * of type glob"

Check the file /etc/salt/roster for fomatting errors.

Note: It doesn't like tabs.

@rdmarsh
rdmarsh / loadled.py
Created April 3, 2015 13:57
Silly program to light up LEDs on raspberrypi piface depending on system load
#!/usr/bin/python
#silly program to light up LEDs on raspberrypi piface depending on system load
#basically multiplys load by x10, rounds, and lights up that many leds
from time import sleep
import pifacedigitalio
import sys
DELAY = 1.0 # seconds
@rdmarsh
rdmarsh / loadstrobe.py
Created April 3, 2015 14:48
Simple prog to chase leds up and down for the rasberrypi piface. The higher the load, the slower they go
#!/usr/bin/python3
#Simple prog to chase leds up and down for the rasberrypi piface
#The higher the load, the slower they go
from time import sleep
import pifacedigitalio
import sys
if __name__ == "__main__":
@rdmarsh
rdmarsh / gist:ea4e02b03551b786d793
Last active February 7, 2018 23:33
syslog-ng error binding socket
Starting syslog-ng: Error binding socket; addr='AF_UNIX(/dev/log)', error='Address already in use (98)'
Error initializing source driver; source='s_sys', id='s_sys#1'
Error initializing message pipeline;
[FAILED]
to solve: rm /dev/log
@rdmarsh
rdmarsh / nzbget
Last active December 10, 2017 12:36
nzbget logrotate
/var/nzbget/dst/nzbget.log {
missingok
notifempty
size 2M
rotate 4
copytruncate
}
@rdmarsh
rdmarsh / gen.xml
Last active March 7, 2016 12:55
Basic settings for red, green, yellow and blue keys in kodi
<?xml version="1.0" encoding="UTF-8"?>
<keymap>
<global>
<keyboard>
<escape>Pause</escape>
<key id="251">activatewindow(home)</key>
<key id="252">activatewindow(videos,movietitles)</key>
@rdmarsh
rdmarsh / remote.xml
Last active July 16, 2016 04:40
Stop a video in kodi when backing out of it
<?xml version="1.0" encoding="UTF-8"?>
<keymap>
<FullscreenVideo>
<remote>
<back>stop</back>
</remote>
<keyboard>
<back>stop</back>
<backspace>stop</backspace>
<escape>stop</escape>
@rdmarsh
rdmarsh / chips.yml
Created March 12, 2016 12:26
Set CHIP up as an airplay server using ansible playbook
---
# Set CHIP up as an airplay server.
# Based on https://www.hackster.io/11798/c-h-i-p-play-speakers-7cebb9
# Note; you will still have to edit shairport-sync.conf to set the name
- name: configure chips for iot shairport use
hosts: shairport-chips
become_user: root
@rdmarsh
rdmarsh / centertext.pl
Last active June 1, 2016 04:17
simple example to center text on a line
#!/usr/bin/env perl -w
### 2016-06-01:davidm:simple program to center text on a line
use strict;
use warnings;
use POSIX;
#f1: string
#f2: total width
@rdmarsh
rdmarsh / taildisk.md
Last active July 16, 2016 01:09
check data near end of disk

write last 2MB of disk to a file

# tailfile="taildisk-`date "+%Y%m%dT%H%M%S"`.dat"
# dd if=/dev/sda of=${tailfile} bs=512 skip=$(( $(blockdev --getsz /dev/sda) - 4096 ))
4096+0 records in
4096+0 records out
2097152 bytes (2.1 MB, 2.0 MiB) copied, 0.0185222 s, 113 MB/s
# ls -lah ${tailfile}

-rw-r----- 1 root root 2.0M Jul 16 11:08 taildisk-20160716T110821.dat