Skip to content

Instantly share code, notes, and snippets.

View derpeter's full-sized avatar
🖖

derpeter derpeter

🖖
  • planet earth, milkiway
View GitHub Profile
@derpeter
derpeter / to25fps.py
Created May 31, 2024 09:39
to25fps.py
import os
import subprocess
path = os.getcwd()
for file in os.listdir(path):
if file.endswith("mp4"):
if "old" not in file:
f = os.path.join(path, file)
print("found " + f)
old_file = os.path.join(path, file.split(".")[0] + "-old.mp4")
@derpeter
derpeter / update-odoo-pip
Created February 9, 2022 08:12
Small script to update odoo modules installed via pip
pip install --upgrade pip
pip list --outdated --format=freeze | grep odoo | grep -v '^\-e' | cut -d = -f 1 | xargs -n1 pip install -U
# # Retrieve data from MODBUS slave devices
[[inputs.modbus]]
# ## Connection Configuration
# ##
# ## The plugin supports connections to PLCs via MODBUS/TCP or
# ## via serial line communication in binary (RTU) or readable (ASCII) encoding
# ##
# ## Device name
name = "SOLAR"
#
@derpeter
derpeter / bme280.py
Created March 29, 2021 09:26
BME280 telegraf exec plugin
#!/usr/bin/env python3
import time
try:
from smbus2 import SMBus
except ImportError:
from smbus import SMBus
from bme280 import BME280
# Initialise the BME280
@derpeter
derpeter / gpd-micropc-keyboard.sh
Created July 7, 2019 11:05 — forked from joshskidmore/gpd-micropc-keyboard.sh
Uses xmodmap + xcape to use the MicroPC's bottom row a bit more efficiently
#!/usr/bin/env bash
# resets keyboard; kills all running instances of xcape
reset_kbd () {
local xcape_cnt=$(pgrep xcape | wc -l)
echo " - reset_kbd"
echo " - killing $xcape_cnt instances of xcape"
setxkbmap -layout us
@derpeter
derpeter / ubuntu-mate-gpd-micropc.sh
Last active July 7, 2019 11:00 — forked from joshskidmore/ubuntu-mate-gpd-micropc.sh
ubuntu-mate-gpd-micropc.sh
#!/usr/bin/env bash
# update
apt -y update
apt -y upgrade
apt -y dist-upgrade
# 5.2 mainline kernel
cd /tmp
wget https://kernel.ubuntu.com/~kernel-ppa/mainline/v5.2-rc6/linux-headers-5.2.0-050200rc6_5.2.0-050200rc6.201906222033_all.deb
@derpeter
derpeter / proyektortest.xml
Last active June 25, 2019 19:27
proyektortest
<schedule>
<version>1.0</version>
<conference>
<title>Fusion Festival - Content 2019</title>
<acronym>fusion19</acronym>
<days>5</days>
<start>2019-06-26</start>
<end>2019-06-30</end>
<timeslot_duration>0:30</timeslot_duration>
</conference>
This can be used as a starting point for developing your own image e.g. for running MirageOS on an Pi3
You will need an arm64 / aarch64 cross compiler. You can use e.g. the cross compiler shipped by Ubuntu or get the toolchain of your choice for your OS.
apt-get install gcc-aarch64-linux-gnu
Now we setup the SD card. We need to create two partitions like shown below
Device Boot Start End Sectors Size Id Type
2018-03-13-raspbian-stretch-lite.img1 8192 93802 85611 41,8M c W95 FAT32 (LBA)
@derpeter
derpeter / compare.sh
Created October 15, 2017 12:21
compare the size of files with the same filename in two directorys
#!/bin/bash
DIR1=~/bar/
DIR2=~/foo/
SIZE1=0
SIZE2=0
for file in $DIR1*; do
file2=$DIR2$(basename "$file")
if [[ -f $file ]] && [[ -f $file2 ]]; then
@derpeter
derpeter / reencode.sh
Created October 14, 2017 01:50
reencode all video files in an folder that a bigger than a configured value to save disk space
#!/bin/bash
MIN_SIZE=6G
IN_DIR=.
OUT_DIR=out
find $IN_DIR -maxdepth 1 -type f -size +$MIN_SIZE -exec ffmpeg -y -i {} -c:v libx264 -preset slow -tune film -profile:v high -level 4.2 -crf 23 -c:a copy -c:s copy $OUT_DIR/{} \;