Skip to content

Instantly share code, notes, and snippets.

View RenaKunisaki's full-sized avatar
🦊
Hacking a lamp

Rena Kunisaki RenaKunisaki

🦊
Hacking a lamp
View GitHub Profile
@RenaKunisaki
RenaKunisaki / lolav.txt
Created February 17, 2025 20:44
libav is too complicated for deepseek-14b
>>> What's the correct way to determine a frame's play timestamp (as UNIX timestamp) in libav?
<think>
Okay, I need to figure out how to get the play timestamp of each frame as a UNIX timestamp using libav. Hmm, I remember that libav has some
structures and functions for handling frames and streams.
So first, I think about the steps involved. Each frame has its own presentation time, right? In libav, frames are part of a stream context, so
maybe I need to access each stream's parameters.
I recall there's an AVStream struct which contains information about the stream, including a timebase. The timebase is used to convert
@RenaKunisaki
RenaKunisaki / report-split-overlaps.py
Created January 5, 2025 22:03
Report overlaps in dtk splits.txt
#!/usr/bin/env python3
"""Parse splits.txt and report overlaps."""
import sys
def parseSectionLine(line):
"""Parse a section definition."""
parts = line[1:].split() # skip the leading tab
sec = parts.pop(0)
fields = {}
for part in parts:
@RenaKunisaki
RenaKunisaki / dedupe.py
Created October 16, 2024 15:34
Python script for deduplicating files/moving non-duplicate files by hash
#!/usr/bin/env python3
"""File deduplication tool
by Rena Kunisaki, 2024 Oct 14
Performs two functions:
--move fromPath toPath: Moves files from fromPath to toPath, if not already
present in toPath. Files are compared by hash, not name, so this skips
already-present files even if they have a different name.
--dedupe path: Scans for duplicate files in path. For each file that appears
more than once, prompts the user to keep one copy and removes the others.
@RenaKunisaki
RenaKunisaki / resumebake.py
Created August 25, 2023 18:41
Blender script to resume a bake
import bpy
""" Script to resume a physics bake from a specific time in Blender.
This addresses the incredible fact that there's apparently no way
to change a bake without re-baking the entire animation, even if
the change is halfway through. It also addresses the similarly
incredible fact that you can't play an animation to the end and not
have it automatically restart and discard all caches.
@RenaKunisaki
RenaKunisaki / motion.log
Created June 20, 2019 00:14
motion.log
[0:motion] [NTC] [ALL] [Jun 16 16:26:12] motion_startup: Using log type (ALL) log level (NTC)
[0:motion] [NTC] [ALL] [Jun 16 16:26:12] become_daemon: Motion going to daemon mode
[0:motion] [NTC] [ALL] [Jun 16 16:26:12] become_daemon: Created process id file /var/run/motion/motion.pid. Process ID is 535
[0:motion] [NTC] [ALL] [Jun 16 16:26:12] motion_startup: Motion running as daemon process
[0:motion] [NTC] [ENC] [Jun 16 16:26:12] ffmpeg_init: ffmpeg libavcodec version 57.48.101 libavformat version 57.41.100
[0:motion] [NTC] [ALL] [Jun 16 16:26:12] main: Camera 0 is from /etc/motion/motion.conf
[0:motion] [NTC] [ALL] [Jun 16 16:26:12] main: Camera 0 is device: /dev/video0 input -1
[0:motion] [NTC] [ALL] [Jun 16 16:26:12] main: Stream port 8081
[0:motion] [NTC] [ALL] [Jun 16 16:26:12] main: Waiting for threads to finish, pid: 535
[1:ml1] [NTC] [ALL] [Jun 16 16:26:12] motion_init: Camera 0 started: motion detection Enabled
@RenaKunisaki
RenaKunisaki / glsl_test.py
Last active January 26, 2022 21:33
moderngl test
#!/usr/bin/env python
import moderngl_window as mglw
import moderngl
import struct
VERTEX_SHADER = """
#version 400
/** Shader for drawing lines of varying thickness,
* including bezier curves.
@RenaKunisaki
RenaKunisaki / glsl_test.py
Created June 11, 2019 18:28
moderngl vbo test
#!/usr/bin/env python
import gi
gi.require_version('Gtk', '3.0'); from gi.repository import Gtk, Gdk, GLib
import moderngl
import struct
VERTEX_SHADER = """
#version 400
/** Shader for drawing lines of varying thickness,
@RenaKunisaki
RenaKunisaki / trackball.py
Created June 3, 2019 01:34
Use trackball as scroll wheel
#!/usr/bin/env python3
# This script opens the given device and maps its
# axis movements to scroll wheel events,
# so you can use a trackball to scroll any window.
# You will need to run `xinput disable $DEVICE` to
# prevent it from also moving the cursor.
DEVICE = "Primax Kensington Eagle Trackball"
import evdev
import pynput
This file has been truncated, but you can view the full file.
Setting breakpad minidump AppID = 255710
Steam_SetMinidumpSteamID: Caching Steam ID: 76561198349434752 [API loaded no]
Loading Mono
Mono location: /opt/steam/.local/share/Steam/steamapps/common/Cities_Skylines/Cities_Data/Mono/x86_64
Steamworks_RegisterMonoInterface()
Successfully Hooked RenderAPI_OpenGLCoreES (17) [Message]
Loading Steamworks
DLC status: 73
dlc 'Cities: Skylines - Preorder Pack' id: '340160' available: 'false'
dlc 'Cities: Skylines - Deluxe Edition Upgrade Pack' id: '346791' available: 'false'
<?xml version="1.0" encoding="UTF-8"?>
<inkscape-extension xmlns="http://www.inkscape.org/namespace/inkscape/extension">
<_name>Split Fill and Stroke</_name>
<id>githubacct.uniqueid.Name_of_your_extension</id>
<dependency type="executable" location="extensions">split-fill-stroke.py</dependency>
<param name="achoice" type="boolean" _gui-text="A boolean value">false</param>
<effect>
<object-type>all</object-type>
<effects-menu>
<submenu _name="Objects"/>