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
bit = require "bit" | |
ev = require "ev" | |
ltn12 = require "ltn12" | |
socket = require "socket" | |
-- make protect and newtry coroutine friendly | |
socket.protect = (fn) -> fn | |
socket.newtry = (finalizer) -> | |
(...) -> |
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
-- Iterate through each item in each array table passed to iterator | |
-- doesn't have any allocations | |
all_values = do | |
y = coroutine.yield | |
free_workers = setmetatable {}, __mode: "k" | |
process_head = (skip, first, ...) -> | |
y nil if skip | |
return if first == nil |
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
lapis = require "lapis" | |
db = require "lapis.db" | |
lapis.serve class extends lapis.Application | |
"/": => | |
json: db.query "select * from v_domains" |
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
lpeg 0.10 | |
Timings: | |
* assign p: 1.814ms c: 0.816ms | |
* bubbling p: 1.772ms c: 3.925ms | |
* class p: 2.610ms c: 18.459ms | |
* comprehension p: 2.478ms c: 3.077ms | |
* cond p: 2.801ms c: 2.379ms | |
* destructure p: 2.561ms c: 2.183ms |
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
pt_in_box = (px, py, x1, y1, x2, y2) -> | |
if x2 < x1 | |
x1,x2 = x2, x1 | |
if y2 < y1 | |
y1,y2 = y2, y1 | |
not (px < x1 or px > x2 or py < y1 or py > y2) | |
line_intersection = (x1, y1, x2, y2, x3, y3, x4, y4, is_axis=false) -> |
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
.test(left, @color) { | |
border-left: 1px solid @color; | |
} | |
.test(right, @color) { | |
border-right: 1px solid @color; | |
} | |
div { | |
.test(right, blue); | |
} |
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
port = 8989 | |
http = require "http" | |
spawn = require("child_process").spawn | |
banned = [ | |
# "172.16.22.195" | |
# "172.16.22.149" | |
# "172.16.22.166" | |
# "172.16.22.98" |
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
#!/bin/bash | |
scrot '%Y-%m-%d_%H-%M-%S.png' -s -e 'scp $f [email protected]:www/shotsnb;echo -n "http://leafo.net/shotsnb/$f" | xclip; rm $f' | |
notify-send -u normal -t 1000 'Screenshot Ready' |
NewerOlder