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 lldb | |
import os | |
import sys | |
symbol_types = {} | |
for x in dir(lldb): | |
if x.startswith('eSymbolType'): | |
symbol_types[getattr(lldb, x)] = x[len('eSymbolType'):] | |
dbg = lldb.SBDebugger.Create() |
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 svgpathtools as svg | |
from typing import List, Tuple | |
def points(path: svg.Path): | |
for seg in path: | |
yield seg.start | |
yield path.end | |
def normalized(x: complex) -> complex: | |
return x / abs(x) |
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
# on server that has virtual machine, IP is 192.168.1.207 | |
# in virt-manager, add a serial port, it will show up as /dev/pts/something | |
sudo socat -d -d file:/dev/pts/1 TCP-LISTEN:9090 | |
# on laptop that is plugged into device, -x will log communication as hex | |
sudo socat -x -d -d /dev/ttyUSB0,b9600,raw TCP:192.168.1.207:9090 | |
# then remote into virtual machine and use the serial port! |
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
from threading import Event, Thread | |
import bpy | |
from inotify_simple import INotify, flags | |
import traceback | |
# this is still buggy on properly cleaning things up on exit | |
def run(exit: Event, changed: Event, filename): | |
inotify = INotify() | |
inotify.add_watch(filename, flags.MODIFY) |
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
#!/usr/bin/env bash | |
trap 'kill $(jobs -pr) 2>/dev/null' SIGINT SIGTERM EXIT | |
browser=chromium-browser | |
python3 -m http.server & | |
$browser "http://localhost:8000/$1" 2>/dev/null & | |
browserpid=$! |
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
// clang -g -O2 -I/usr/include/ffmpeg -lavformat -lavutil -lavcodec avformat_example.c -o avformat_example | |
#include <assert.h> | |
#include <libavcodec/avcodec.h> | |
#include <libavformat/avformat.h> | |
#include <libavutil/file.h> | |
int main(int argc, char *argv[]) { | |
if (argc != 2) { |
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 itertools | |
import numpy as np | |
from PIL import Image | |
from operator import itemgetter | |
from collections import defaultdict | |
import base64 | |
import io | |
dirs_map = { | |
(1, 0) : 'R', |
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
""" | |
python reimplementation of http://schepers.cc/getting-to-the-point (source http://schepers.cc/svg/path/catmullrom2bezier.js) | |
Pretty much the coolest thing ever | |
""" | |
from collections import namedtuple | |
import numpy as np | |
Point = namedtuple('Point', ('x', 'y')) | |
def catmull_rom_to_bezier(points): |
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
# generic migration template | |
from playhouse.migrate import * | |
from models import * | |
migrator = SchemaMigrator.from_database(database) | |
def add_column(field): | |
return migrator.add_column(field.model._meta.table_name, field.column_name, field) |
NewerOlder