Skip to content

Instantly share code, notes, and snippets.

View speed-transition-Audio.lua
local sense=-20
local speed = mp.get_property("speed")
local detect = false
function f(msg)
if string.find(msg.text, "silence_end") and detect then
mp.set_property("speed",speed)
endmsg=msg.text
detect = false
--print("end")
elseif string.find(msg.text, "silence_start") and detect==false then
@bitingsock
bitingsock / speed-between-subs.lua
Last active Sep 14, 2021
Increases playback speed if a subtitle has not been displayed; resumes normal speed when a new subtitle is shown
View speed-between-subs.lua
---user settings---
local WaitTime = 0.1 --how long until we try to enter "fast" mode
local lookAhead = 5 --how far ahead to look for subtitles when trying to enter "fast" mode
local fast = 6 --how fast "fast" mode is by default
local rewind = 0.2 --how far to rewind when entering normal mode; note that if this is more than or equal to WaitTime + lookAhead you will probably enter an infinite loop
---
local searchtimer
local checktimer
local waitTimer
local normal = mp.get_property("speed")
@HaleTom
HaleTom / print256colours.sh
Last active Oct 18, 2021
Print a 256-colour test pattern in the terminal
View print256colours.sh
#!/bin/bash
# Tom Hale, 2016. MIT Licence.
# Print out 256 colours, with each number printed in its corresponding colour
# See http://askubuntu.com/questions/821157/print-a-256-color-test-pattern-in-the-terminal/821163#821163
set -eu # Fail on errors or undeclared variables
printable_colours=256
@kometbomb
kometbomb / tweetjam.md
Last active Sep 9, 2021
PICO-8 tweetjam stuff
View tweetjam.md

PICO-8 size optimization stuff

Here are some simple ways to make your PICO-8 code fit in 140 280 characters (as in the #tweetjam craze). I did not invent these, I merely observed and collected them from the tweetjam thread.

LUA syntax stuff

  • Use single character variable names
  • Use x=.1 and x=.023, not x=0.1 or x=0.023
  • x=1/3 is shorter than x=.3333
  • You don't need to separate everything with spaces or write them on their own lines, e.g. circ(x,y,1)pset(z,q,7) works just as well
@nknauth
nknauth / arne-cnes-88.gpl
Created Oct 10, 2014
Arne's CNES-88 Palette, v8
View arne-cnes-88.gpl
GIMP Palette
#
# by Arne Niklas Jansson
# http://androidarts.com/
#
0 0 0 Untitled
0 23 125 Untitled
2 74 202 Untitled
0 132 255 Untitled
91 168 255 Untitled
@tylerneylon
tylerneylon / learn.lua
Last active Sep 26, 2021
Learn Lua quickly with this short yet comprehensive and friendly script. It's written as both an introduction and a quick reference. It's also a valid Lua script so you can verify that the code does what it says, and learn more by modifying and running this script in your Lua interpreter.
View learn.lua
-- Two dashes start a one-line comment.
--[[
Adding two ['s and ]'s makes it a
multi-line comment.
--]]
----------------------------------------------------
-- 1. Variables and flow control.
----------------------------------------------------
@spicycode
spicycode / tmux.conf
Created Sep 20, 2011
The best and greatest tmux.conf ever
View tmux.conf
# 0 is too far from ` ;)
set -g base-index 1
# Automatically set window title
set-window-option -g automatic-rename on
set-option -g set-titles on
#set -g default-terminal screen-256color
set -g status-keys vi
set -g history-limit 10000
@albertsun
albertsun / linebreaks_wp.py
Created Aug 21, 2011
Python port of WordPress's wpautop filter
View linebreaks_wp.py
import re
from django import template
from django.utils.functional import allow_lazy
from django.template.defaultfilters import stringfilter
from django.utils.safestring import mark_safe, SafeData
from django.utils.encoding import force_unicode
from django.utils.html import escape
from django.utils.text import normalize_newlines
register = template.Library()