Skip to content

Instantly share code, notes, and snippets.

curl -X POST -H 'Content-type:application/json' -d '{"jsonrpc":"2.0","method":"user.login","params":{ "user":"unamehere","password":"passwdhere"},"auth":null,"id":0}' http://zabbixserver/zabbix/api_jsonrpc.php
response: {"jsonrpc":"2.0","result":"hex-code-here","id":0}
requst:
curl -X POST -H 'Content-type:application/json' -d '{
"jsonrpc": "2.0",
"method": "problem.get",
"params": {
"output": "extend",
@tomfanning
tomfanning / gist:b7e90c92442fb9ee6bd41956737f2831
Created July 24, 2017 15:39
Linux command to drill down and find disk space
du -ch -d 1 | sort -hr
@tomfanning
tomfanning / install-zabbix-agent.sh
Last active March 23, 2019 17:06
Install zabbix agent on Ubuntu trusty 14.04
#!/bin/sh -e
echo "Setting up Zabbix agent"
wget --quiet http://repo.zabbix.com/zabbix/3.2/ubuntu/pool/main/z/zabbix-release/zabbix-release_3.2-1+trusty_all.deb
dpkg -i zabbix-release_3.2-1+trusty_all.deb
rm zabbix-release_3.2-1+trusty_all.deb
apt-get update --quiet > /dev/null
apt-get install zabbix-agent -y --quiet > /dev/null
echo "PidFile=/var/run/zabbix/zabbix_agentd.pid
LogFile=/var/log/zabbix/zabbix_agentd.log
LogFileSize=10
@tomfanning
tomfanning / obj-diff.cs
Created June 20, 2017 08:53
C# reflection-based object diff
public class Compared
{
public object Left { get; set; }
public object Right { get; set; }
}
public static System.Collections.Generic.Dictionary<string, Compared> Diff(object o1, object o2)
{
var result = new System.Collections.Generic.Dictionary<string, Compared>(StringComparer.Ordinal);
@tomfanning
tomfanning / repeater-controller.ino
Created May 5, 2017 12:53
Trivial crossband repeater controller
/*
* Trivial crossband repeater controller
* Yaesu FT-1500m to Baofeng with carrier detect pin brought out
*
* 1k resistor to NPN transistor base on D5 and D6
* Baofeng PTT pin to D5 transistor collector
* Yaesu data port PTT pin to D6 transistor collector
* FT-1500m data port SQL line to A0
* Baofeng CD line to A1
*
@tomfanning
tomfanning / $GPRMC GPS NMEA sentence breakdown.txt
Last active March 4, 2023 03:00
$GPRMC GPS NMEA sentence breakdown
$GPRMC,170047.00,A,4121.23302,N,00201.31654,W,2.703, ,200417, , ,A*64
$GPRMC,hhmmss.ss,A,llll.ll, a,yyyyy.yy, a,x.x, x.x,ddmmyy,x.x,a,m*hh
| | | | | | | | | | | | \- 13 Checksum
| | | | | | | | | | | \--- 12 Mode indicator, (A=Autonomous, D=Differential, E=Estimated, N=Data not valid)
| | | | | | | | | | \----- 11 E or W of magnetic variation
| | | | | | | | | \--------- 10 Magnetic variation degrees (Easterly var. subtracts from true course)
| | | | | | | | \---------------- 9 UTC date of fix
| | | | | | | \-------------------- 8 Track made good in degrees True
| | | | | | \-------------------------- 7 Speed over ground in knots
| | | | | \---------------------------- 6
@tomfanning
tomfanning / kiss-test.cs
Last active April 14, 2017 21:59
Minimal C# .NET implementation of a position-reporting APRS client for a serial KISS TNC (tested with Mobilinkd)
using System;
using System.Collections;
using System.Collections.Generic;
using System.IO.Ports;
using System.Text;
namespace kiss_test
{
class Program
{
@tomfanning
tomfanning / callpass.cs
Last active March 25, 2024 20:13
APRS passcode generator in C#
class Program
{
static void Main(string[] args)
{
System.Console.WriteLine(DoHash("mycall"));
}
static int DoHash(string call)
{
string upper = call.ToUpper();
@tomfanning
tomfanning / test.sh
Created February 21, 2017 00:21
rtl_fm sox ices2 direwolf icecast experiments
rtl_fm -f 144800000 -p 42 - | sox --buffer 128 -t raw -r 24k -es -b 16 -c 1 > /root/144800.wav
rtl_fm -f 144800000 -p 42 - | sox --buffer 128 -t raw -r 24k -es -b 16 -c 1 - -t wav -r 24k - > /root/144800.wav
rtl_fm -f 144800000 -p 42 - | tee /root/144800.raw | sox --buffer 128 -t raw -r 24k -es -b 16 -c 1 - -t wav -r 24k - > /root/144800.wav
rtl_fm -f 144800000 -p 42 - | tee <(direwolf -t 0 -c /root/direwolf.conf -r 24000 -D 1 -q d > /tmp/dw.log) | sox --buffer 128 -t raw -r 24k -es -b 16 -c 1 - -t wav -r 24k - > /root/144800.wav
@tomfanning
tomfanning / relocate-pg-data-to-compressed-zfs-vol.sh
Last active January 18, 2017 15:16
Script to relocate postgres 9.5 data dir on Ubuntu 14.04 to a compressed ZFS volume (single disk, /dev/sdb, assumed to be blank)
#!/bin/bash -e
# Script to relocate postgres 9.5 data dir on Ubuntu 14.04 to a compressed ZFS volume (single disk, /dev/sdb, assumed to be blank)
# install ZFS and tools
apt-get install software-properties-common rsync -y
echo "
" | add-apt-repository ppa:zfs-native/stable
apt-get update
apt-get install ubuntu-zfs -y