Skip to content

Instantly share code, notes, and snippets.

View themactep's full-sized avatar

Paul Philippov themactep

View GitHub Profile
@themactep
themactep / stl2png.sh
Created May 9, 2023 03:06
thumbnailer for .stl files
#!/bin/bash
# .STL files thumbnailer
# 2022, Paul Philippov, [email protected]
set -euo pipefail
OS=$(command -v openscad || command -v openscad-nightly)
IFS=$'\n\t'
@themactep
themactep / scad2png.sh
Created May 9, 2023 03:06
thumbnailer for .scad files
#!/bin/bash
# .SCAD files thumbnailer
# 2022, Paul Philippov, [email protected]
OS=$(command -v openscad || command -v openscad-nightly)
$OS -o "$2.png" -D "\$fn=128" --autocenter --viewall \
--colorscheme="Tomorrow Night" -q "$1"
[ ! -f "$2.png" ] && echo "Cannot find image!" && exit 1
@themactep
themactep / test-video-delay.sh
Last active May 27, 2024 17:47
IP camera video stream delay test
#!/bin/bash
#
# GStreamer based script for glass-to-glass latency testing.
# Use it together with https://thingino.com/timer
#
# 2023, Paul Philippov <[email protected]>
#
if ! command -v gst-launch-1.0 >/dev/null; then
echo "This script requires GStreamer."
#!/bin/sh
# Compression test
# Paul Philippov <[email protected]>
payload=""
name="payload"
in="${name}.txt"
[ -d ./test_data/ ] && rm -r ./test_data/
[ ! -d ./test_data/ ] && mkdir ./test_data/
// ==UserScript==
// @name CSDN tweaker
// @namespace http://themactep.com/
// @version 0.1
// @description Show full articles
// @author [email protected]
// @match https://*.blog.csdn.net/*
// @icon https://www.google.com/s2/favicons?sz=64&domain=csdn.net
// @grant none
// ==/UserScript==
#!/bin/sh
#
# Format SD card to two small FAT32 partitions
# for guaranteed usage with embedded devices
# Paul Philippov <[email protected]>
#
show_help() {
echo "Usage: $0 [OPTIONS]>
Where:
-d <device> SD Card device (e.g. /dev/sdc).
#!/bin/sh
# Convert text from GB 2312 charset to Unicode, translate to English.
# cn2en.sh <file.txt>
# Paul Philippov <[email protected]>
# 20200926
infile=$1
cnfile="${infile%.*}.cn.${infile##*.}"
enfile="${infile%.*}.en.${infile##*.}"
#!/bin/sh
# GPIO switcher
# Paul Philippov <[email protected]>
PIN=$1
MODE=$2
if [ -z "$PIN" ] || [ -z "$MODE" ]; then
echo "Usage: $0 <pin#> <1|0|x>"
exit 1
#!/bin/bash
#
# Convert deprecated apt-key keys storage to GPG keys.
# Paul Philippov <[email protected]>
#
keys=$(sudo apt-key list | grep -A1 ^pub | grep "^ " | sed "s/\s*//g" | sort | uniq)
for k in $keys; do
sudo apt-key export $k | \
sudo gpg --dearmour -o /usr/share/keyrings/$k.gpg --yes &&
#!/bin/bash
#
# OpenIPC full firmware file assembler.
# Creates a file suitable for programming a flash chip.
#
# Example:
# ./compile4programmer.sh uboot.bin uImage rootfs.squashfs 8
#
# Running this command will produce a new binary file
# full4programmer-8MB.bin or full4programmer-16MB.bin