Skip to content

Instantly share code, notes, and snippets.

import numpy as np
old = np.load("../data/The Smashing Pumpkins - Today@192x144__bw__25.0fps.webm.npy")
new = np.load("../data/The Smashing Pumpkins - Today@480x360__bw__25.0fps.mp4.npy")
len(old)
len(new)
new2 = []
for f in range(len(new)):
frame = [[0 for x in range(18)] for y in range(28)]
for x in range(28):
vcgencmd get_throttled
docs:
https://www.raspberrypi.com/documentation/computers/os.html#get_throttled
https://www.raspberrypi.com/documentation/computers/config_txt.html#monitoring-core-temperature
0: under-voltage
1: arm frequency capped
2: currently throttled
3: soft temperature limit active
#!/usr/bin/python3
import argparse
from lightness.settings import Settings
from lightness.videoplayer import VideoPlayer
from lightness.videoprocessor import VideoProcessor
import numpy as np
import sys
import cv2
import time
#!/usr/bin/python3
import argparse
from lightness.settings import Settings
from lightness.videoplayer import VideoPlayer
from lightness.videoprocessor import VideoProcessor
import numpy as np
import cv2
import time
import io
#!/usr/bin/python3
import subprocess
subprocess.Popen(["python3", "/home/pi/lightness/lightness/server.py"])
subprocess.Popen(["python3", "/home/pi/lightness/lightness/queue.py"])
works on zsh, not bash:
youtube-dl --output - --format 18 'https://www.youtube.com/watch?v=luDxN1Pz6G8' | tee >(ffplay -nodisp -vn -autoexit -i pipe:0 -v quiet -infbuf ) | ffmpeg -threads 1 -i pipe:0 -filter:v scale=28x18 -c:a copy -f rawvideo -pix_fmt rgb24 -v quiet -stats pipe:1 && echo dunzo
works on both bash and zsh:
youtube-dl --output - --format 18 'https://www.youtube.com/watch?v=luDxN1Pz6G8' | tee >(ffplay -nodisp -vn -autoexit -i pipe:0 -v quiet -infbuf ) >(ffmpeg -threads 1 -i pipe:0 -filter:v scale=28x18 -c:a copy -f rawvideo -pix_fmt rgb24 -v quiet -stats pipe:1 && echo dunzo) > /dev/null
works on neither bash nor zsh:
<?php
$stdin = fopen('php://stdin', 'r');
while (true) {
$input = fgets($stdin);
if ($input == false) {
echo "php EOF!\n";
break;
}
<?php
$stdin = fopen('php://stdin', 'r');
while (true) {
$input = fgets($stdin);
if ($input == false) {
echo "php EOF!\n";
break;
}
import subprocess
import os
r,w = os.pipe()
proc = subprocess.Popen(
"echo 123456123123123123123123123123 >&" + str(w) + " && (sleep 2 && echo bar >&" + str(w) + ") && sleep 4 && exec " + str(w) +"<&- && sleep 6 && echo foo >&" + str(w),
shell = True,
executable = '/bin/bash', # use bash so we can make use of process subsitution
pass_fds = (w,)
)
import subprocess
import os
r,w = os.pipe()
proc = subprocess.Popen(
"echo 123456123123123123123123123123 >&" + str(w) + " && (sleep 2 && echo bar >&" + str(w) + ") && sleep 4 && exec " + str(w) +"<&- && sleep 6 && echo foo >&" + str(w),
shell = True,
executable = '/bin/bash', # use bash so we can make use of process subsitution
pass_fds = (w,)
)