Skip to content

Instantly share code, notes, and snippets.

ethaniel /
Last active February 4, 2023 18:47
Grafana: Highlight 12 hour intervals in graphs for easier viewing
  1. Open Grafana dashboard settings.
  2. Go to "Annotations"
  3. Create an annotation with a data source "InfluxDB" and add the following query:
import "array"
import "timezone"
import "date"

option location = timezone.location(name: "Asia/Bangkok")
ethaniel / min_teamviewer.ahk
Last active October 19, 2022 13:33
AutoHotKey script to minimize the TeamViewer side panel when I connect to a computer
View min_teamviewer.ahk
; Save this file somewhere (I keep it on my desktop) as min_teamviewer.ahk and run it once
; It will create a shortcut in the Startup folder, so it will be loaded automatically on system reboot
#SingleInstance Force
DetectHiddenText, on
ethaniel /
Last active August 27, 2022 07:58
asterisk: symbol lookup error: /lib/ undefined symbol: ast_register_file_version

Recently, I've been upgrading manually compiled Asterisk on my Centos to a version coming from Tucny's Repo. When starting up the Asterisk, I've noticed the following error:

asterisk: symbol lookup error: /lib/ undefined symbol: ast_register_file_version

The problem came from leftover files from the manual build. Here is how I fixed this:

rm -rfv /lib/libasterisk*
rm -rfv /usr/lib/asterisk
ethaniel /
Last active February 12, 2022 08:46
Split one RTSP stream into multiple gstreamer pipelines
  1. Get RTSP video, decode it, apply framerate and send to shared buffer. Don't forget to set shm-size to something high, because you're now dealing with decoded raw video:

gst-launch-1.0 -v rtspsrc location="rtsp://" protocols=tcp latency=1000 ! watchdog timeout=10000 ! rtph264depay ! h264parse ! avdec_h264 ! videorate ! video/x-raw,framerate=30/1 ! shmsink wait-for-connection=false socket-path=/tmp/foo shm-size=100000000

  1. Note the caps in the output:

/GstPipeline:pipeline0/GstShmSink:shmsink0.GstPad:sink: caps = video/x-raw, format=(string)I420, width=(int)2560, height=(int)1440, interlace-mode=(string)progressive, pixel-aspect-ratio=(fraction)1/1, chroma-site=(string)mpeg2, colorimetry=(string)1:0:0:0, framerate=(fraction)30/1

  1. Read decoded video from shared buffer (input the width,height,format,framerate caps from above):
ethaniel / relative_to_absolute.php
Created November 26, 2021 03:35
PHP script for converting relative humidity to absolute humidity
View relative_to_absolute.php
// formulas courtesy of
$pressure = 1000; // Pressure in hPa
$temperature = 25; // Temperature in Celsius
$humidity = 75; // Relative Humidity in %
$e = 2.71828;
$tp = ($pressure * 133.322)/100;
ethaniel / ceph_deep_scrub.php
Last active March 22, 2022 23:49
This script controls Ceph deep scrubs, making sure that each OSD is busy with a deep scrub.
View ceph_deep_scrub.php
Script to always have 1 deep scrub running per OSD.
## About
1. Helps with the following error: PG_NOT_DEEP_SCRUBBED HEALTH_WARN (N pgs not deep-scrubbed in time)
2. Doesn't run scrubbing on PGs that were deep scrubbed less than 2 weeks ago, releasing
ethaniel /
Last active February 4, 2023 10:02
HOWTO: Receive SMS via 4G/LTE Huawei stick on Raspberry Pi 4 and forward them via Telegram

HOWTO: Receive SMS via 4G/LTE Huawei stick on Raspberry Pi 4 and forward them via Telegram

I live abroad and have only 1 sim card slot in my phone. It holds the SIM card of the country that I am in right now. But I also have another SIM card from my home country which receives my banking SMS codes. I can't afford to lose the "home" SIM card, so I decided to keep it in my house and forward the SMS messages to my main phone and computer via Telegram (just like Whatsapp, but so much better).

I also made a choice to use a 4G/LTE stick instead of 3G, because the 3G signal in my area is getting worse in worse due to operators upgrading their equipment.


  1. Raspberry Pi 4
  2. Huawei E8372 (but can be any similar)

Step 1 - Get the Huawei card to work properly with Raspberry