Skip to content

Instantly share code, notes, and snippets.

View juzam's full-sized avatar

Giovanni Angoli juzam

  • Italia
View GitHub Profile
@juzam
juzam / blink1_infocon
Last active December 10, 2015 19:39
Super simple ISC Infocon to blink(1) script
#!/bin/bash
# reduntant check since in cygwin both options works the same way
if [ $OS = "cygwin" ]; then
BLINK1TOOL=/usr/local/bin/blink1-tool.exe
else
BLINK1TOOL=/usr/local/bin/blink1-tool
fi
# colour mapping
@juzam
juzam / huff.sh
Last active August 27, 2018 00:23
huffduffer automator
#!/bin/bash
URL=$1
WORKDIR=/tmp
# puff.py helper location
PUFF=/usr/local/bin/puff.py
ID=`youtube-dl --get-id $URL`
#!/usr/bin/env python
from datetime import timedelta, tzinfo
from dateutil import tz
from shlex import split
from subprocess import Popen, PIPE
import os
import plistlib
NOT_ENABLED = u'Not enabled.'
@juzam
juzam / PageLinks
Created February 5, 2014 09:33
Get all links in a page Bookmarklet, adapted from: http://forums.mozillazine.org/viewtopic.php?p=2190545#p2190545
#! /bin/sh
# Starts and stops node-red
# /etc/init.d/node_red
### BEGIN INIT INFO
# Provides: node_red
# Required-Start: $syslog
# Required-Stop: $syslog
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: Node Red
#!/bin/bash
#
# This starts and stops shairport
#
### BEGIN INIT INFO
# Provides: sonos-airplay
# Required-Start: $network
# Required-Stop:
# Short-Description: Sonos Airplay Bridge
# Description: Sonos Airplay Bridge
@juzam
juzam / inkpen.md
Created March 6, 2014 11:36
Created using Inkpen - http://inkpen.in

tstamp = Math.floor(Date.parse(iso-8601-tstamp)/1000);

@juzam
juzam / check_nf_conntrack_count
Created March 10, 2014 09:04
Nagios/Icinga nf_conntrack_count check
#!/bin/sh [0/329]
# takes warning and critical percentage as $1 and $2 parameters
# if not specified defaults to 95% and 97% respectivley
STATUS_CRITICAL=1
STATUS_WARNING=2
STATUS_OK=0
WARNING_LEVEL=${1:-95}
@juzam
juzam / pinoccio_proxy.flow
Last active August 29, 2015 13:59
Pinoccio Node Red command proxy flow - First Draft
[{"id":"1f8dc6c2.cba389","type":"mqtt-broker","broker":"localhost","port":"1883","clientid":"nodered-1"},{"id":"fb5bdbec.60523","type":"mqtt out","name":"","topic":"","broker":"1f8dc6c2.cba389","x":1010.25,"y":158,"z":"f1e02243.ca166","wires":[]},{"id":"fd3d9542.f0877","type":"inject","name":"\"print power.percent\" Command Example","topic":"","payload":"{\"troop\": \"1\", \"scout\": \"1\", \"topic\": \"result\", \"command\": \"print power.percent\"}","payloadType":"string","repeat":"","crontab":"","once":false,"x":200.5,"y":227.5,"z":"f1e02243.ca166","wires":[["1e34db31.3aea5d"]]},{"id":"b16c8037.41ae8","type":"http request","name":"REST POST","method":"POST","url":"","x":620,"y":158.25,"z":"f1e02243.ca166","wires":[["898e121d.69f8d","cab5ea3b.2ee23"]]},{"id":"898e121d.69f8d","type":"function","name":"Prepare Output","func":"data = JSON.parse(msg.payload);\n\nreading = { payload: data.data.reply.trim() , topic: msg.topic, retain: 1 };\ntstamp = { payload: data.data._t, topic: msg.topic + \"/tstamp\", retain
#!/bin/bash
### BEGIN INIT INFO
# Provides: node-red
# Required-Start: $local_fs $remote_fs $network
# Required-Stop: $local_fs $remote_fs $network
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: Start or stop the node-red server
### END INIT INFO
# Can be downloaded and installed in one go by using this command