Skip to content

Instantly share code, notes, and snippets.

@msfeldstein
msfeldstein / remove-red-frames.py
Created April 6, 2023 17:39
Remove Red Frames
import cv2
import numpy as np
from moviepy.editor import VideoFileClip, concatenate_videoclips
def is_red_pixel(pixel):
blue,green,red = pixel
return red > 200 and green < 100 and blue < 100
def process_image(image):
# Convert image to BGR format as used by OpenCV
{
"nodes" : [
{
"distance" : 0,
"heard" : 24205652,
"node" : "GBFDG",
"qset" : {
"t" : 4,
"v" : [ "sdf_watcher1", "eno", "tempo.eu.com", "sdf_watcher2", "sdf_watcher3" ]
},
### Keybase proof
I hereby claim:
* I am msfeldstein on github.
* I am feldstein (https://keybase.io/feldstein) on keybase.
* I have a public key ASCT_UWljuCYnzIvc-DH9pb8jr-aq13ITEebiVKu0f4PvAo
To claim this, I am signing this object:

date: 24-02-2019 title: How I used p2p protocols to make simpler and more resilient software

Lately I've been working on a project called dat-mirror which lets you mirror p2p websites you author from a computer with a persistent connection, such as a raspberry pi. One of the main issues with p2p and beaker browser is that if you publish from your laptop, as soon as you close your laptop your page becomes unavailable. dat-mirror keeps a copy served from your pi so your site will always be available, including over http for people on mobile, or who don't have beaker.

The first version of this worked ok, but had enough setup complications and runtime gotchas that it wasn't worth releasing. After reading this tutorial on p2p libraries I was able to re-architect a lot of this to be more resilient, flexible, and easier to set up.

Discovery

Without any p2p technology, the only way to connect to the da

Persistent SSH Sessions with tmux

I use my raspberry pi exclusively over ssh. While it's great to be able to use my regular laptop to control my pi, ssh has some downsides:

  • Difficult to start long-running processes
  • Lose all your state when you close your laptop
  • Need to re-ssh in every new tab

tmux is a terminal multiplexer which is a program that can manage terminal sessions for you. We can start a session on login of your pi, and then whenever we ssh in we can automatically connect to that same session. When you log out and re-connect, you'll get the same terminal windows with the same processes still running. Suddenly those problems are now features:

Verifying my Blockstack ID is secured with the address 15MXt2XMepBQMhsDdmBYvdUJr5Rr3YYVis https://explorer.blockstack.org/address/15MXt2XMepBQMhsDdmBYvdUJr5Rr3YYVis
### Keybase proof
I hereby claim:
* I am msfeldstein on github.
* I am feldstein (https://keybase.io/feldstein) on keybase.
* I have a public key ASDJ1XIEsf7BCYW_nXQen7pjW1UDATSnvm7mvGoKj3lbxQo
To claim this, I am signing this object:
function logThreeInstances(className) {
threeTypeMap[className] = 0;
const orig = THREE[className];
const tmp = function() {};
tmp.prototype = THREE[className].prototype;
function newConstructor() {
orig.apply(this, arguments)
/**
* Modified version of something Dubiously created by Adrian Cooney
* http://adriancooney.github.io
* adapted from https://github.com/adriancooney/console.snapshot
*/
(function(console) {
function getBox(width, height) {
return {
string: "+",
style: "font-size: 1px; padding: " + Math.floor(height/2) + "px " + Math.floor(width/2) + "px; line-height: " + height + "px;"
var twgl = require('twgl.js')
var canvas = document.createElement('canvas')
document.body.appendChild(canvas)
const vtx = `
attribute vec4 position;
void main() {
gl_Position = position;
}