Skip to content

Instantly share code, notes, and snippets.

#!/usr/bin/env nix-shell
#!nix-shell -i sh -p websocat gst_all_1.gst-plugins-base gst_all_1.gst-plugins-good gst_all_1.gst-plugins-bad gst_all_1.gst-libav coreutils
set -ex
(lsmod | grep v4l2loopback >/dev/null) || sudo modprobe v4l2loopback video_nr=10 card_label=v4l2-iphone
websocat --binary ws://${IPAD:-shimarin}/ws | dd bs=8 skip=1 | gst-launch-1.0 fdsrc ! queue ! mpegvideoparse ! avdec_mpeg2video ! videoconvert ! videorate ! 'video/x-raw, format=YUY2, framerate=30/1' ! v4l2sink device=/dev/video10 sync=false
@Michcioperz
Michcioperz / ve-lapses.py
Created March 21, 2021 21:46
dynamic background chooser (ve means violet evergarden)
#!/usr/bin/env nix-shell
#!nix-shell -i python3 -p "python3.withPackages (ps: [ps.astral ps.pytz])"
import dataclasses
import datetime
import enum
import functools
import itertools
import math
import subprocess
import time
@Michcioperz
Michcioperz / Dockerfile
Created September 2, 2020 16:27
librespot for openwrt netgear r6220
FROM debian:buster
RUN dpkg --add-architecture mipsel && apt-get update && apt-get install -y wget xz-utils
RUN wget https://downloads.openwrt.org/releases/19.07.2/targets/ramips/mt7621/openwrt-sdk-19.07.2-ramips-mt7621_gcc-7.5.0_musl.Linux-x86_64.tar.xz && tar xf openwrt-sdk-*.tar.* && rm openwrt-sdk-*.tar.*
ENV STAGING_DIR=/openwrt-sdk-19.07.2-ramips-mt7621_gcc-7.5.0_musl.Linux-x86_64/staging_dir
ENV PATH=/openwrt-sdk-19.07.2-ramips-mt7621_gcc-7.5.0_musl.Linux-x86_64/staging_dir/toolchain-mipsel_24kc_gcc-7.5.0_musl/bin:/root/.cargo/bin:$PATH:/usr/bin:/bin:/usr/sbin:/sbin
RUN wget https://sh.rustup.rs -O rustup-init && chmod +x rustup-init && ./rustup-init --profile minimal -y
RUN rustup target add mipsel-unknown-linux-musl
RUN apt-get install git --no-install-recommends -y
RUN git clone https://github.com/librespot-org/librespot
WORKDIR librespot
ext.postBuildExtras = {
android.splits.density.enable = true
android.splits.density.compatibleScreens = ['small', 'normal', 'large', 'xlarge']
ext.densityCodes = ['ldpi': 1, 'mdpi': 2, 'hdpi': 3, 'xhdpi': 4, 'xxhdpi': 5, 'xxxhdpi': 6]
android.applicationVariants.all { variant ->
variant.outputs.each { output ->
def baseDensityVersionCode = project.ext.densityCodes.get(output.getFilter("DENSITY"))
if (baseDensityVersionCode == null) { baseDensityVersionCode = 0 }
output.versionCodeOverride = android.defaultConfig.versionCode * 10 + baseDensityVersionCode
}
#!/usr/bin/env python3
import yaml, requests, os, argparse
with open(os.path.expanduser("~/budget.yaml")) as f:
data = yaml.load(f)
currency = data.get('settings', dict()).get('currency', None)
parser = argparse.ArgumentParser()
parser.add_argument("currency", default=currency, nargs=('?' if currency is not None else 1))
@Michcioperz
Michcioperz / sk1.sh
Created November 3, 2016 20:50
gotowiec Piotrka
#!/bin/bash
g++ -o sol sol.cpp
for((i=0;i<100;i++)) do
echo "Test $i"
./sol < fla$i.in > wyj.out
diff -w -q wyj.out fla$i.out
[[ $? -ne 0 ]] && break
done
@Michcioperz
Michcioperz / impressioni.sh
Created February 15, 2016 21:41
how to get more impressions (with dedication to @md-5)
#!/bin/bash
for i in {1..529}
do
wget https://upload.wikimedia.org/wikipedia/commons/5/54/Claude_Monet%2C_Impression%2C_soleil_levant.jpg
done
@Michcioperz
Michcioperz / hostmenow.py
Created January 11, 2016 15:49
quick file sharing over network solution based on lighttpd
#!/usr/bin/env python3
import argparse, tempfile, subprocess, os
parser = argparse.ArgumentParser()
parser.add_argument("-p", "--port", type=int, default=5004)
args = parser.parse_args()
conffd, conffile = tempfile.mkstemp(suffix="hostmenow")
os.close(conffd) # because it's idiotic
with open(conffile, "w") as f:
f.write("""
@Michcioperz
Michcioperz / now-with-quotes.txt
Last active November 8, 2015 19:40
Amazement of Life example story, I suppose
Verónica Guerrero, Isaiah Alyssa Mitchell and John Elijah Castillo met up in the exit near the stairway to discuss the amazement of life together.
"So what do you think about Pixie Lott?", said John.
"Isn't it a bit like down Budrosa?", said Isaiah.
"Reminds me of a ecstatic funeral director.", said John.
"Feels to me like thrifty neue slowenische kunst.", said Verónica.