Skip to content

Instantly share code, notes, and snippets.

@74togo
74togo / FloydSteinberg.html
Last active November 6, 2020 02:51
An example of the Floyd–Steinberg applied to images in Javascript.
<html>
<head>
<title>Dithering Test</title>
</head>
<body>
<canvas></canvas>
<script>
var canvas = document.getElementsByTagName("canvas")[0];
@74togo
74togo / irc connection trick
Created January 26, 2014 19:49
A trick to autheticate on connection to an IRC server
A trick to autheticate on connection to an IRC server
/connect irc.freenode.net 6667 :<username> <password>
In xchat, this means you put :<username> <password> into the server password box.
@74togo
74togo / sub.py
Last active August 29, 2015 14:11
Testing listener model that is thread safe
from threading import Thread, Lock, Condition, get_ident, current_thread
from collections import deque, namedtuple
import time
cond = Condition()
lock = Lock()
ThreadSub = namedtuple("ThreadSub", ["queue", "callbacks"])
subscriptions = {"chat":{}, "file":{}}
@74togo
74togo / start_recording.sh
Created May 19, 2015 23:25
timelapse recorder
#!/bin/bash
a=1
compile_video()
{
trap exit SIGINT
# modify these as needed
FPS=15
@74togo
74togo / weights.py
Created July 16, 2015 17:45
Solution to weights problem
from math import log
def toList(num):
return toList(num // 3) + [["L"], ["-"], ["R"]][num % 3] if num else []
def solution(n):
return toList(n + sum(3**x for x in range(1 + int(log(n*2, 3)))))