Skip to content

Instantly share code, notes, and snippets.

View siberex's full-sized avatar
🛠️
Your stack will not be full without me

Stephen Jingle siberex

🛠️
Your stack will not be full without me
View GitHub Profile
@t3dotgg
t3dotgg / try-catch.ts
Last active August 24, 2025 12:51
Theo's preferred way of handling try/catch in TypeScript
// Types for the result object with discriminated union
type Success<T> = {
data: T;
error: null;
};
type Failure<E> = {
data: null;
error: E;
};
@dataslayermedia
dataslayermedia / real-time-temperature-output-coral-ai-pcie-accelerators.sh
Last active April 26, 2025 01:05
real-time-temperature-output-coral-ai-pcie-accelerators
#!/bin/bash
# Function to convert millidegree Celsius to Fahrenheit
convert_to_fahrenheit() {
local temp_milli_c=$1
# Convert millidegree Celsius to Celsius
local temp_c=$(echo "scale=4; $temp_milli_c / 1000" | bc)
# Convert Celsius to Fahrenheit
echo "scale=2; ($temp_c * 9 / 5) + 32" | bc
}
@dataslayermedia
dataslayermedia / coral-ai-pcie-edge-tpu-raspberrypi-5-setup
Last active July 9, 2025 00:36
Install Coral AI PCIe Edge TPU on Raspberry Pi 5
#!/bin/bash
cd /
sudo apt update
echo "deb https://packages.cloud.google.com/apt coral-edgetpu-stable main" | sudo tee /etc/apt/sources.list.d/coral-edgetpu.list
curl https://packages.cloud.google.com/apt/doc/apt-key.gpg | sudo apt-key add -
@s-geissler
s-geissler / fancontrol.sh
Last active December 29, 2024 04:34
Manual fancontrol on Raspberry Pi 5 for Ubuntu 23.10 64bit
#!/bin/bash
round() {
printf "%.${2}f" "${1}"
}
debug() {
if [[ $debug -eq 1 ]]; then
echo "[$(date)] [DEBUG] $1" >> "$2"
fi
@maximebories
maximebories / convert.md
Last active August 27, 2025 07:23
FFmpeg command to convert webm to mp4 video files

WebM to MP4 using FFmpeg

This FFmpeg command converts a .webm video file to a standard .mp4 file using the libx264 codec for video, aac codec for audio, and a CRF value of 22. The preset is set to 'slow' for higher quality encoding, and the audio bitrate is set to 128 kbps.

If the input and output filenames don't contain spaces, quotation marks or other special characters:

ffmpeg -i input.webm -c:v libx264 -preset slow -crf 22 -c:a aac -b:a 128k output.mp4
@a-gavin
a-gavin / README.md
Created August 30, 2022 05:14
Raspberry Pi Picoprobe Debug Setup/Tips & Tricks

Raspberry Pi Picoprobe Debug Setup/Tips & Tricks

This document details useful information on how to use a Raspberry Pi Pico as a SWD probe for another Pico using the Picoprobe software. This information assumes you have followed all of the steps in Appendix A of the Getting Started with Raspberry Pi Pico Guide and that you are doing development on a Linux system.

Essential Setup

  1. Add the below files to your system to enable non-root access to the devices

    /etc/udev/rules.d/99-openocd.rules:

    # Raspberry Pi Picoprobe
    

ATTRS{idVendor}=="2e8a", ATTRS{idProduct}=="0004", MODE="0666"

@tylermorganwall
tylermorganwall / submarine_cable_map.R
Last active August 3, 2025 06:01
Submarine Cable Map Dataviz
library(geojsonsf)
library(sf)
library(rayrender)
#Data source: https://github.com/telegeography/www.submarinecablemap.com
cables = geojson_sf("cable-geo.json")
cablescene = list()
counter = 1
for(i in 1:length(cables$geometry)) {
/**
* Egg-dropping problem.
* You have limited number of (crystal) eggs and limited number of throws,
* and want to check some tower, determining highest floor where egg
* will not break when thrown from there.
*
* This function will tell the max height of the building which could be tested
* with the given number of eggs and throws.
*
* @param n int Number of eggs
@siberex
siberex / generic.sh
Last active December 1, 2022 07:11
Generic bash script stuff
#!/usr/bin/env bash
# Exit script when command fails
set -o errexit
# Exit when script tries to use undeclared variable
set -o nounset
# Exit if piped command fails
set -o pipefail
# aka:
# set -euo pipefail
@siberex
siberex / cancelot.sh
Last active July 29, 2024 21:40
Provides automation for cancelling previous ongoing Cloud Builds for the same branch/trigger
#!/usr/bin/env bash
# https://github.com/siberex/cancelot
#
# To download the latest version (if you trust running random bash scripts from the internets!):
# curl -L https://gist.github.com/siberex/bb0540b208019382d08732cc6dd59007/raw -o cancelot.sh && chmod +x cancelot.sh
#
# Provides automation for cancelling Cloud Builds
# Use as a first step to cancel previous builds currently in progress or queued for the same branch name and trigger id.
# Similar to: https://github.com/GoogleCloudPlatform/cloud-builders-community/tree/master/cancelot