Skip to content

Instantly share code, notes, and snippets.

@spiffin
spiffin / koken-nginx.conf
Last active October 12, 2019 16:51
Nginx configuration for Koken 0.22.21 (2017)
server {
# General
# Listen on both ipv4 and ipv6
listen 80;
listen [::]:80;
server_name MYDOMAIN.COM;
@spiffin
spiffin / Telegraf_RoonCore_Grafana_template.json
Last active January 23, 2017 15:55
Grafana template for displaying Telegraf metrics from Roon Core
{
"__inputs": [
{
"name": "DS_TELEGRAF_ON BRIX",
"label": "Telegraf on BRIX",
"description": "",
"type": "datasource",
"pluginId": "influxdb",
"pluginName": "InfluxDB"
}
@spiffin
spiffin / telegraf.conf
Created January 23, 2017 14:55
Telegraf config for collecting Roon Core metrics
# Global tags can be specified here in key="value" format.
[global_tags]
# dc = "us-east-1" # will tag all metrics with dc=us-east-1
# rack = "1a"
## Environment variables can be used as tags, and throughout the config file
# user = "$USER"
# Configuration for telegraf agent
[agent]
@spiffin
spiffin / pagespeed_.pl
Last active August 6, 2018 12:33
Munin plugin for displaying Pagespeed stats
#!/usr/bin/perl
#
# Monitor mod_pagespeed statistics
#
# pagespeed_cache
# pagespeed_css
# pagespeed_js
# pagespeed_html
# pagespeed_img
# pagespeed_bw
@spiffin
spiffin / Clear_tags.scpt
Created March 10, 2015 18:45
AppleScript to clear Finder tags on selected item(s)
--Requires tag app available via homebrew: brew install tag
tell application "Finder"
set fileNames to {}
set theItems to selection
repeat with itemRef in theItems
set end of fileNames to POSIX path of (itemRef as text) & space
end repeat
end tell
do shell script "/usr/local/bin/tag --remove \\* " & fileNames
@spiffin
spiffin / LMS_play_favorite.scpt
Created March 2, 2015 20:00
AppleScript to play LMS favorites (Logitech Media Server)
set serverIP to "192.168.1.80" --change to your server IP
--Your first favorite has an item_id of 0, the second=1, third=2, etc.
--So, to play your first favorite:
do shell script "printf \"favorites playlist play item_id:0\nexit\n\" | nc " & serverIP & " 9090"
--Second:
--do shell script "printf \"favorites playlist play item_id:1\nexit\n\" | nc " & serverIP & " 9090"
@spiffin
spiffin / LMS_playing.scpt
Created March 2, 2015 19:52
AppleScript for displaying the currently playing track, artist and album in LMS (Logitech Media Server)
--No extra requirements
set serverIP to "192.168.1.80" --change to your server IP
set title to do shell script "printf \"current_title ?\nexit\n\" | nc " & serverIP & " 9090 | cut -d ' ' -f 3 | perl -pe 's/\\%(\\w\\w)/chr hex $1/ge'"
set artist to do shell script "printf \"artist ?\nexit\n\" | nc " & serverIP & " 9090 | cut -d ' ' -f 3 | perl -pe 's/\\%(\\w\\w)/chr hex $1/ge'"
set album to do shell script "printf \"album ?\nexit\n\" | nc " & serverIP & " 9090 | cut -d ' ' -f 3 | perl -pe 's/\\%(\\w\\w)/chr hex $1/ge'"
if album is equal to "" then
return "Playing " & title
else
return "Playing " & title & " by " & artist & " from " & album
@spiffin
spiffin / FIP_currently_playing.scpt
Last active August 29, 2015 14:15
AppleScript for displaying the currently playing track on FIP Radio in a notification
--Requires Twitter Scripter: http://mousedown.net/mouseware/TwitterScripter.html
--Requires a Twitter account to be set up in System Prefs > Internet Accounts
--Change "your_Twitter_name" in the line below to your Twitter name
--Save as Application and trigger with a keyboard shortcut
tell application "Twitter Scripter"
set fipNow to fetch user timeline for username "FipNowPlays" using account "your_Twitter_name" returning entries 1
set nowPlayingTweet to |text| of item 1 of response of fipNow
@spiffin
spiffin / LMS_currently_playing.scpt
Last active December 21, 2015 06:05
AppleScript for displaying the currently playing track, artist and album in LMS (Logitech media Server)
--Note: only displays notification when run, e.g. via an Alfred keyboard shortcut
--Requires JSON Helper: http://www.mousedown.net/mouseware/JSONHelper.html
--
--Settings
set serverIP to "192.168.1.1" -- your server IP
set portNo to "9000"
set playerID to "xx:xx:xx:xx:xx:xx" -- your player MAC address in Server Settings
--get status feed
set statusFeed to do shell script "curl --data '{\"id\":1,\"method\":\"slim.request\",\"params\":[" & "\"" & playerID & "\"" & ",[\"status\",\"-\",1]]}' http://" & serverIP & ":" & portNo & "/jsonrpc.js"
@spiffin
spiffin / ioping_stats.sh
Last active September 23, 2017 12:41
Munin plugin for ioping (monitor VPS disk latency, seek rate and sequential speed)
#!/bin/sh
#
# Monitor VPS disk latency, seekrate and speed via ioping
#
# Requirements:
#
# ioping 0.8: https://code.google.com/p/ioping/
# ioping path = /usr/bin/ioping (symlink it if it's somewhere else)
#
# Parameters understood: