Skip to content

Instantly share code, notes, and snippets.

View mpeterv's full-sized avatar

Peter Melnichenko mpeterv

View GitHub Profile
@mpeterv
mpeterv / output.txt
Created February 15, 2015 14:18
Luarocks unused variables
src/luarocks/admin_remove.lua:33:24: unused variable 'login_url'
src/luarocks/admin_remove.lua:37:52: unused variable 'password'
src/luarocks/build.lua:123:20: unused variable 'err'
src/luarocks/build.lua:178:13: unused variable 'ok'
src/luarocks/build.lua:184:10: value assigned to variable 'ok' is unused
src/luarocks/build.lua:231:7: value assigned to variable 'ok' is unused
src/luarocks/build.lua:306:4: value assigned to variable 'ok' is unused
src/luarocks/build.lua:309:4: value assigned to variable 'ok' is unused
src/luarocks/build.lua:317:4: value assigned to variable 'ok' is unused
src/luarocks/build.lua:320:4: value assigned to variable 'ok' is unused
@mpeterv
mpeterv / command.sh
Created May 18, 2015 15:53
pflua #216
./env tools/pflua-compile -O0 'tcp and ((tcp[tcpflags] & tcp-syn) != 0) and ((tcp[20] == 3) or ((tcp[20] != 1) and ((tcp[20 + tcp[21]] == 3) or ((tcp[20 + tcp[21]] != 1) and ((tcp[20 + tcp[21] + tcp[20 + tcp[21] + 1]] == 3) or ((tcp[20 + tcp[21] + tcp[20 + tcp[21] + 1]] != 1) and ((tcp[20 + tcp[21] + tcp[20 + tcp[21] + 1] + tcp[20 + tcp[21] + tcp[20 + tcp[21] + 1] + 1]] == 3) or ((tcp[20 + tcp[21] + tcp[20 + tcp[21] + 1] + tcp[20 + tcp[21] + tcp[20 + tcp[21] + 1] + 1]] != 1) and ((tcp[20 + tcp[21] + tcp[20 + tcp[21] + 1] + tcp[20 + tcp[21] + tcp[20 + tcp[21] + 1] + 1] + tcp[20 + tcp[21] + tcp[20 + tcp[21] + 1] + tcp[20 + tcp[21] + tcp[20 + tcp[21] + 1] + 1] + 1]] == 3) or ((tcp[20 + tcp[21] + tcp[20 + tcp[21] + 1] + tcp[20 + tcp[21] + tcp[20 + tcp[21] + 1] + 1] + tcp[20 + tcp[21] + tcp[20 + tcp[21] + 1] + tcp[20 + tcp[21] + tcp[20 + tcp[21] + 1] + 1] + 1]] != 1) and ((tcp[20 + tcp[21] + tcp[20 + tcp[21] + 1] + tcp[20 + tcp[21] + tcp[20 + tcp[21] + 1] + 1] + tcp[20 + tcp[21] + tcp[20 + tcp[21] + 1] + tcp[20 +
@mpeterv
mpeterv / testcase.lua
Created June 8, 2015 18:40
luajit 2.1.0 testcase
-- The following code should print "nil" several times,
-- but one of the nils gets replaced with a table somehow.
local function key(expr)
if type(expr) == 'table' then
-- Removing the zero removes spurious table
local res = {0}
for i=1, #expr do
res[i] = key(expr[i])
-- Uncommenting the following line removes spurious table
#!/usr/bin/env lua
local LineScanner = require("luacov.reporter").LineScanner
local lfs = require "lfs"
local function annotate_file(path)
local lines = {}
local max_len = 0
for line in io.lines(path) do
table.insert(lines, line)
#!/usr/bin/env python3
import fractions
import itertools
import random
sample_size = 200
random.seed(44944755)
new_possible_holes = []
possible_holes = [[(fractions.Fraction(1, 1), fractions.Fraction(1, 1))]]
#!/usr/bin/env lua
local remote_prog = [[
local name = [=[%s]=]
local fh = assert(io.open(name))
local src = assert(fh:read("*a"))
fh:close()
local f = assert((loadstring or load)(src))
local activelines = assert(debug.getinfo(f, "L").activelines)
local lines = {}
for line in pairs(activelines) do table.insert(lines, line) end
#!/usr/bin/env lua
local function visit(node, visited_set, exited_nodes)
visited_set[node] = true
for _, successor in ipairs(node.next) do
if not visited_set[successor] then
visit(successor, visited_set, exited_nodes)
end
end
-- Problem: there is a directed graph and a subset of some A
-- associated with each node. An element of A traverses the graph
-- along the edges from start node S to finish node F, only
-- passing through nodes with sets containing the element.
-- Calculate set of possible visiting elements for each node.
-- Solution: resulting set for a node N is intersection of two sets:
-- set of elements that can reach N from S and set of elements that
-- can reach F from N. They can be calculated for each node separately
-- using forward and backward flow analysis correspondingly, where
-- Problem: there is a directed graph and a subset of some A
-- associated with each node. Some nodes are marked as reset nodes.
-- An element of A traverses the graph
-- along the edges from start node S to finish node F, only
-- passing through nodes with sets containing the element.
-- At reset nodes it can change to any element of A.
-- Calculate set of possible visiting elements for each node.
-- Solution: resulting set for a node N is intersection of two sets:
-- set of elements that can visit N from S and set of starting elements that
@mpeterv
mpeterv / new.txt
Last active May 14, 2016 16:10
`luarocks install sailor` output
Installing https://luarocks.org/sailor-0.5-4.src.rock
Missing dependencies for sailor 0.5-4:
datafile >= 0.1 (not installed)
luafilesystem >= 1.6.2 (not installed)
valua >= 0.2.2 (not installed)
lbase64 >= 20120807 (not installed)
cgilua >= 5.1.4 (not installed)
xavante >= 2.3 (not installed)
wsapi-xavante >= 1.6.1 (not installed)
busted >= 2.0.rc9 (not installed)