Skip to content

Instantly share code, notes, and snippets.

@sport4minus
sport4minus / getmyips.sh
Created January 31, 2024 07:54
shell script to quickly list ip adresses of interfaces
for ifname in `ipconfig getiflist`; do echo $ifname: `ipconfig getifaddr $ifname`; done
@sport4minus
sport4minus / brennenstuhl_control.py
Created February 21, 2023 19:37
python script to control a Brennenstuhl Premium-Web-Line V3
# Brennenstuhl Premium-Web-Line V3 is a socket strip with an embedded web server.
# It can be switched via a web interface or using http get requests. The latter is a bit under-documented,
# so here's what i found out:
# The built-in server accepts only authenticated http get requests (using digest auth).
# each command has its own url, like so: http://{IP-OF-THE-SOCKETSTRIP}/cgi/{commandname}?params
# full list can be found in a PDF called "Premium-Web-Line V3 CGI specification.pdf" which is included in the download package of the official software:
# download link -> https://www.brennenstuhl.com/index.php?module=explorer&index[explorer][action]=download&index[explorer][file]=firmware/premium-web-line-v3-software-3_3_6.zip
# here's an example on how to toggle one of the two relais (nr. 0)
# modified a general digest auth example from stackoverflow: https://stackoverflow.com/questions/23254013/http-digest-basic-auth-with-python-requests-module
@sport4minus
sport4minus / avconv-join-audio-video
Created December 19, 2022 19:27
join audio and video input files -> video with audio channel using libav / avconv
# join audio and video input files -> video with audio channel using libav / avconv
avconv -i in_video.mov -i in_audio.wav -vcodec copy -acodec mp3 -map 0:v:0 -map 1:0 out_audio_video.mov
@sport4minus
sport4minus / gist:18b17e19ce20cdc485e3ad43666f58a8
Created April 5, 2022 08:18
export git commit history to csv with dates cli
git log --since 2021-01-01 --until 2021-12-31 --reverse --pretty=format:"%s;%as" --date=iso > ../export-history.csv
@sport4minus
sport4minus / re-encode-txt-howto.md
Last active January 11, 2022 16:35
batch re-encode windows encoded .txt files to UTF-8 on the MacOS command line

Re-encode all .txt files in a directory from windows-1252 to utf-8 in place

  • using find and iconf commands on osx
  • replaces original files!
  • two-step process:
    • first store all paths to text files in a separate file
    • then do conversion based on each file path
    • why? find -exec with iconv was too hard to figure out on macOS

1:

@sport4minus
sport4minus / run-processing-sketch-from-commandline.md
Last active September 8, 2018 09:35
Run processing.org 3.x exported sketch from commandline

Run processing.org 3.x exported sketch from commandline

example under OSX:

if you have a sketch called Test.pde

  • navigate to application.macosx/Test.app/Contents/Java
  • then call the following line java -cp "*" Test
    -cp "*" makes all the jars in the directory available to java
    Testist the main class name, in Processing usually the name of the Sketch / Main .pde
@sport4minus
sport4minus / deckset_collect.py
Last active January 22, 2017 09:51
Collect all assets used in a deckset presentation, and clone the original file into one with updated references.
#!/bin/python
# deckset_collect.py
# by jens wunderling
# this script collects all assets used in a deckset presentation into one folder and creates an updated .md file
# useful if you wildly use image files all over your local file system
# and for archiving (if online sources go offline)
# i'd like this to be a feature of the main app though :D
import os, argparse, shutil
@sport4minus
sport4minus / crossfade-videos.js
Last active October 24, 2022 18:58
Crossfade two videos on Raspberry Pi /w omxplayer and node.js using omxplayer-controll
/*
crossfade-videos.js by github.com/sport4minus
test based on omxplayer-controll example by github.com/winstonwp
– crossfade two videos on raspberry pi using node.js, omxplayer-controll https://github.com/winstonwp/omxplayer-controll and omxplayer.
– working based on omxplayer's capability to set a video render layer.
– two instances of omxplayer are started on different layers, the upper ones' alpha is changed during runtime.
@sport4minus
sport4minus / actionscript 3 buildsystem
Created March 5, 2015 19:01
Sublime Text 2 Build System Actionscript 3 OSX fixed utf-8 decode error
{
"cmd": [
"/_path_/_to_/flex_sdk_4.6/bin/mxmlc",
"${file}"
],
"selector": "source.actionscript",
"encoding": "cp1252"
}
@sport4minus
sport4minus / load_sequence.pde
Created June 23, 2012 13:52
load image sequence in processing
/**
* this code snippet can be used in the processing environment to load all images in a folder
* "input" in the sketches' data folder into an array of PImages.
* ideally, the images are sequentially named, like 0001.jpg, 0002.jpg etc.
* in this demo, te images are sequentially displayed.
*/
PImage[] imageSequence;
String[] imageFilenames;
void setup() {