Skip to content

Instantly share code, notes, and snippets.

View etihwnad's full-sized avatar

Dan White etihwnad

View GitHub Profile
import zlib
import io
import sys
PNG_MAGIC = b"\x89PNG\r\n\x1a\n"
def parse_png_chunk(stream):
size = int.from_bytes(stream.read(4), "big")
ctype = stream.read(4)
body = stream.read(size)
@wlonkly
wlonkly / debugging.md
Last active July 8, 2021 15:13
Steps I took to troubleshoot a full disk

I wrote this down after I responded to a page today (a holiday) because it would've been a decent pairing opportunity for a couple of new people on my team. Second best is that people can read what I did afterwards and ask me any questions. And then I realized that there's nothing PagerDuty-specific or confidential in here, so I may as well share it wider. It's hardly an epic incident, but it's a good example of "doing the work", I think. I borrowed the "write down what you learned" approach from Julia "b0rk" Evans. It's a fantastic practice.

The PagerDuty incident: "Disk will be full in 12 hours. device:/dev/nvme0n1p1, host:stg-nomadusw2-client-..."

(Note for non-PD readers: We run Nomad where others might run Kubernetes.)

Here's the process I went through.

  • Noticed that the usual docker system prune -a -f didn't resolve it
  • Tried docker system prune -a -f and it cleared up 0B
@flandrade
flandrade / automatically-add-icalendar-events.md
Last active July 5, 2024 19:26
Automatically Add iCalendar Events (.ics) to Calendars

Automatically Add iCalendar Events (.ics) to Calendars

Do you want to create a calendar event so that you can display it on an iPhone's calendar app or in Google Calendar? This can be done by using iCalendar events RFC 5545 as part of the following workflow:

  1. The user signs up for an event online.
  2. The user receives the iCalendar file as an attachment in the email.
  3. The .ics file contains information for the event at a specific time and date.
@darksidelemm
darksidelemm / 2020-11-14_FakeTLE_guide.md
Last active July 2, 2024 00:53
TLE Estimation for an Upcoming Rocket Launch

TLE Estimation for an Upcoming Rocket Launch

Scenario: RocketLab are launching 30 small-sats into space in a few days. We know that one of them is going to be transmitting on the amateur radio bands, but we haven't been able to obtain a pre-launch TLE yet. We want to get setup to use strf to listen for beacon signals (see my guide here), but we need to know when to expect the satellites. We have some basic orbital information from a press release, so how can we use this to estimate a TLE for prediction purposes?

Note: I am approaching this from the point-of-view of someone who really don't know much about orbital mechanics. I'm relying heavily on the experience of others, and the content below is my attempt at documenting the process taken.

Thanks to Cees Bassa for the amazing software as always...

Taken from : https://www.smackfu.com/stuff/programming/shoutcast.html
Webarchive: https://web.archive.org/web/20190521203350/https://www.smackfu.com/stuff/programming/shoutcast.html
Shoutcast Metadata Protocol
How To Parse Titles from MP3 Streams
I wanted to add the ability to show titles from Shoutcast streams on the SliMP3, like Winamp does. The protocol isn't documented anywhere officially (of course). So I ended up cobbling together info from google caches, xmms source code, and mailing lists. Hopefully, this document will save others from the same fate.
## Step 0: Overview picture
-----------------------------------------------------------------------
[ audio data ][metadata.length][metadata][ audio data ]
#include "color.h"
#include "utilities.h"
#include <math.h>
/*
* Algorithm adapted from https://gist.github.com/hdznrrd/656996. Uses a little libmath.
* */
void color_HSV2RGB(struct color_ColorHSV const *hsv, struct color_ColorRGB *rgb) {
int i;
@xoseperez
xoseperez / rpi3_iot_server.md
Last active February 11, 2024 15:05
Raspberry Pi 3 with Mosquitto, Node-RED, InfluxDB, Grafana and Nginx (as a reverse proxy)
@peteristhegreat
peteristhegreat / git diff sqlite3 .gitattributes
Last active March 25, 2024 12:38
Sqlite git diff - Get git to use an sql dump of sqlite3 for showing differences ( .gitconfig config attributes sqlite3 )
*.db diff=sqlite3
@gbaman
gbaman / HowToOTGFast.md
Last active May 14, 2024 10:26
Simple guide for setting up OTG modes on the Raspberry Pi Zero, the fast way!

Setting up Pi Zero OTG - The quick way (No USB keyboard, mouse, HDMI monitor needed)

More details - http://blog.gbaman.info/?p=791

For this method, alongside your Pi Zero, MicroUSB cable and MicroSD card, only an additional computer is required, which can be running Windows (with Bonjour, iTunes or Quicktime installed), Mac OS or Linux (with Avahi Daemon installed, for example Ubuntu has it built in).
1. Flash Raspbian Jessie full or Raspbian Jessie Lite onto the SD card.
2. Once Raspbian is flashed, open up the boot partition (in Windows Explorer, Finder etc) and add to the bottom of the config.txt file dtoverlay=dwc2 on a new line, then save the file.
3. If using a recent release of Jessie (Dec 2016 onwards), then create a new file simply called ssh in the SD card as well. By default SSH i

@brainysmurf
brainysmurf / fillDownOnSubmit.gs
Last active November 2, 2022 00:20
Convenient Fill Down On Submit script for Google Sheets with linked Google Form
/*
by ClassroomTechTools.com
This is free and unencumbered software released into the public domain.
Anyone is free to copy, modify, publish, use, compile, sell, or
distribute this software, either in source code form or as a compiled
binary, for any purpose, commercial or non-commercial, and by any
means.