Skip to content

Instantly share code, notes, and snippets.

View tspspi's full-sized avatar

tspspi

View GitHub Profile
@tspspi
tspspi / unfs3d
Created November 11, 2018 16:55
unfs3 rc.d startup script for FreeBSD
#!/bin/sh
# Startup script for unfs3 (http://unfs3.sourceforge.net) - inofficial script
#
# Use in rc.conf:
# unfs3d_enable="YES"
#
# One can override the location of the exports file via
# unfs3d_exports="/etc/exports"
#
@tspspi
tspspi / owcrc.c
Created October 24, 2018 13:38
1-Wire CRC: A CLI tool to calculate or verify CRC for device ROM IDs
/*
Simply command line tool to calculate CRC
of device ROM IDs for dallas 1-wire devices
(or compatible)
*/
#include <stdio.h>
#include <stdint.h>
static uint8_t crcUpdate8(uint8_t crc, uint8_t data) {
uint8_t j;
@tspspi
tspspi / download_image.sh
Created October 2, 2018 22:54
Periodically fetching webcam images (JPEG) with wget and cron
#!/bin/sh
# === BEGIN CONFIGURATION ===
# Capture source
url="https://www.wien.gv.at/webcam-inselcam/inselcam.jpeg"
# Capture destination and timestamp format
currentdate=`date +"%Y%m%d-%H%M%S"`
@tspspi
tspspi / serdeshelper.h
Last active February 1, 2023 05:01
Floats in C: Simple binary serialization and deserialization of IEEE754 floats independent of architecture
#ifndef __is_included__F0CBD5F3_AC0B_4F2F_9137_1D3A922083A7
#define __is_included__F0CBD5F3_AC0B_4F2F_9137_1D3A922083A7 1
/*
Requires stdint.h and math.h
*/
/*
IEEE 754 Floats (Single):
All Bits 1+r+p 32 Bit
@tspspi
tspspi / UriMatcher.java
Last active October 25, 2018 10:08
UriMatcher like available on Android without Android dependencies
/*
Derived from Android Source Code
Source: platform_frameworks_base/core/java/android/content/UriMatcher.java
(see for example: https://android.googlesource.com/platform/frameworks/base/+/android-7.0.0_r33/core/java/android/content/UriMatcher.java )
Original License: Apache License, Version 2 (http://www.apache.org/licenses/LICENSE-2.0)
Original Copyright: Copyright (C) 2006 The Android Open Source Project
Modifications made:
To be useable outside the Android Framework android.net.Uri has been changed to
java.net.URL, reordered constant definitions towards the top of the class, no