This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# set -Eeuo pipefail | |
# Splits video to separate scenes files | |
# Source: https://gist.github.com/achesco/4dc2ebf13378a0a61fc26c7fe01f539e | |
# Inspired by https://stackoverflow.com/a/38205105 | |
# The "-c:v h264_videotoolbox \" argument makes it work faster on Apple Silicon | |
# computers. | |
# ❗The bitrate argument is overriden in this version, we look at the original bitrate. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# concatenate videos given start and end filenames | |
# https://trac.ffmpeg.org/wiki/Concatenate | |
# expect naming convention from achesco's split-to-scenes.sh: | |
# https://gist.github.com/achesco/4dc2ebf13378a0a61fc26c7fe01f539e | |
# leading 4 digits from $1 and $2 | |
begin=${1:0:4} | |
end=${2:0:4} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# ensure mac is updated to 15.2 | |
# install xcode from app store | |
xcode-select --install | |
sudo xcodebuild -license | |
sudo xcodebuild -runFirstLaunch | |
# clean up install on sequoia so macports can find clang | |
sudo rm -rf /Library/Developer/CommandLineTools/usr/include/c++ | |
# install macports from .pkg file available at the 'Sequoia' Link | |
# https://www.macports.org/install.php |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import machine | |
import time | |
import utime | |
class Nunchuk(object): | |
"""The Nunchuk object presents the sensor readings in a polling way. | |
Based on the fact that the controller does communicate using I2C we | |
cannot make it push sensor changes by using interrupts or similar | |
facilities. Instead a polling mechanism is implemented, which updates | |
the sensor readings based on "intent-driven" regular updates. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import asyncio | |
import websockets | |
from http.server import HTTPServer, SimpleHTTPRequestHandler | |
from socketserver import ThreadingMixIn | |
myip = b'127.0.0.1' | |
def replace_localhost(data): | |
return data.replace(b'localhost', myip) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// MAIN FUNCTION | |
// This function will scrape all the conversations from the chatorg website | |
// It will return an array of arrays, the outer array is of all conversation | |
// the inner array is a list of message pairs | |
// grab all anchors | |
// advance to the next anchor | |
// pull the current chat history | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import asyncio | |
from fastapi import FastAPI, WebSocket | |
from fastapi.responses import FileResponse | |
from fastapi.staticfiles import StaticFiles | |
import os | |
import websockets | |
app = FastAPI() | |
# Mount the static files in the storage/node_modules/gun directory under the /gun path |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# based on https://gist.github.com/jhass/652dd780d23c1e236ff913e8a2b77eb2 | |
# http://jsbin.com/wonitaqode/edit?js,output | |
# mitmproxy -s cors.py | |
# mitmdump -s cors.py | |
from mitmproxy import http | |
def response(flow): | |
h = flow.request.headers |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# a blender-python script that generates a normal distribution of cubes and ico-spheres | |
# then animates a subset of the objects, levitating a few objects into a line to the left and a few to the right | |
import bpy, numpy | |
from mathutils import * | |
radius = 30 | |
n_samples = 50 | |
samples = numpy.random.multivariate_normal([-0.5, -0.5], [[radius, 0],[0, radius]], n_samples) #returns an array of arrays |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
input | |
.split('\n') | |
.map((e, i, a) => i && a[i] - a[i - 1]) | |
.filter(n => n > 0) | |
.length | |
// 1527 | |
// create a new array, then scan the input, adding each element to its coresponding index and the next two indexes as well | |
// is the number of additions any different than looking ahead and behind for each of them? | |
// for 1st strategy, for each element, I read 3 and write once. |
NewerOlder