{{ message }}

Instantly share code, notes, and snippets.

# kageru

Last active Jan 28, 2017 — forked from FichteFoll/snap_scenechanges.py
Snap start and end times of ASS subtitles to scene changes using WWXD
View snap_scenechanges.py
 #!/usr/bin/env python3.6 """Snap start and end times of ASS subtitles to scene changes using WWXD. Does not work with variable frame rate (VFR). usage: snap_scenechanges.py [-h] [--epsilon EPSILON] [-o OUTPUT] [-v] sub_path video_path
Created Dec 20, 2017
Day 19 of the Advent of Code in nim (both parts)
View day19.nim
 import sequtils import future import nre except toSeq type Direction = enum up = 0, left = 1, down = 2, right = 3 Grid = seq[seq[char]]
Created Dec 20, 2017
Day 8 of the Advent of Code in nim (only the first part)
View day8.nim
 import tables import nre import strutils let pattern = re"(?\w+)\s(?(inc|dec))\s(?-?\d+)\sif\s(?\w+)\s(?(<|>|==|!=|<=|>=))\s(?-?\d+)" var registers = initTable[string, int]();
Created Dec 21, 2017
Advent of Code Day 20 in nim (only the first part)
View day20.nim
 import strutils import future import nre # 3-dimensional vector type with attributes for x, y, and z # Mainly used for readability type Vector = object x, y, z: int
Last active Jan 17, 2018
digital die, just paste in into the python/ipython shell
View pydie.py
 from random import randint from functools import partial def d(m, n=1): s = 0 print(f'{n}d{m}') for _ in range(n): r = randint(1, m) s += r print(r)
Created Jan 28, 2018
just converts framenumbers to split parts for now
View mkvmerge-audiocut.py
 #!/usr/bin/env python3 """ Just very basic for now. It only prints an mkvmerge command. TODOs: - properly get input file (or get it at all, lul) - do the splitting for the user - actually parse vs scripts - get delay from source file (and --sync the output) - add pluses automatically so you only get one file
Last active Feb 15, 2018
A simple script to move/rename a file/folder and change m3u playlist entries accordingly. Portmanteau of mv and m3u
View mv3u
 #!/bin/bash # Move/rename a file/folder and change all m3u playlists in \$playlists accordingly # Usage: # \$ mv3u old_filename "new filename" # change this playlists='/path/to/your/playlists' src="\$1"
Created Jul 1, 2019
Arch port of https://github.com/Nyr/openvpn-install
View openvpn-install-arch.sh
 #!/bin/bash # # Original: https://github.com/Nyr/openvpn-install # # Copyright (c) 2013 Nyr. Released under the MIT License. # Minor changes by kageru to make the script run on Arch. if [[ "\$EUID" -ne 0 ]]; then echo "Sorry, you need to run this as root" exit
Created Jul 2, 2019
Mainly a proof of concept. There are better ways to do this, but it was a quick experiment to create something like Python’s slicing in Kotlin.
View kotlin-python-slice.kt
 import kotlin.math.min object start { infix fun to(other: Int) = RangeTuple(0, other) infix fun to(other: end) = RangeTuple(0, Int.MAX_VALUE) } object end infix fun Int.to(other: end) = RangeTuple(this, Int.MAX_VALUE)
Last active Oct 15, 2019
This project was moved to https://github.com/kageru/Irrational-Encoding-Wizardry
View kagefunc.py
 """ This project was moved to https://github.com/kageru/Irrational-Encoding-Wizardry. Don't expect this gist to be updated regularly. """ import vapoursynth as vs import mvsfunc as mvf import fvsfunc as fvf from functools import partial
You can’t perform that action at this time.