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:

Background = new BackgroundLayer backgroundColor: "#f6f6f6"
# Placing all fields within a container
Container = new Layer backgroundColor: "transparent", width:1080, height:2000
Container.center()
#Container.style.padding = "10px 0 0 0 "
# 10 Fields
for colNumber in [0...9]
Field = new Layer
Verifying my Blockstack ID is secured with the address 15MXt2XMepBQMhsDdmBYvdUJr5Rr3YYVis https://explorer.blockstack.org/address/15MXt2XMepBQMhsDdmBYvdUJr5Rr3YYVis
@msfeldstein
msfeldstein / gist:7adea36e5662a6a9ea34
Last active August 23, 2017 23:18
Just a couple guys in a view
class CompoundLayer extends Layer
@define "selectedTab",
get: -> @_selectedTab || 0
set: (p) ->
@_selectedTab = p
for tab, i in @tabs
tab.opacity = 1 - Math.abs(i - p)
constructor: (opts) ->
### 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)