Skip to content

Instantly share code, notes, and snippets.

View soulik's full-sized avatar

Mário Kašuba soulik

View GitHub Profile
@soulik
soulik / desert.hrd
Created December 18, 2019 10:19
Nice dark theme for Far Colorer
<?xml version="1.0" encoding="windows-1251"?>
<!DOCTYPE hrd PUBLIC "-//Cail Lomecb//DTD Colorer HRD take5//EN"
"http://colorer.sf.net/2003/hrd.dtd">
<hrd xmlns="http://colorer.sf.net/2003/hrd">
<assign name="def:Text" fore="#FFFFFF" back="#333333"/>
<assign name="def:HorzCross" fore="#B8F08C" back="#303030"/>
<assign name="def:VertCross" fore="#B8F08C" back="#303030"/>
<assign name="def:Number" fore="#BEF08C"/>
<?php
class PasswordGenerator {
var $pwdMinLength = 12;
var $pwdMaxLength = 20;
var $pwdMap = [
[
'chars' => 'abcdefghijklmnopqrstuvwxyz',
'weight' => 30,
],
@soulik
soulik / html.lua
Last active September 30, 2023 20:20
HTML/XML grammar LPEG parser for Lua
local lpeg = require 'lpeg'
local L = lpeg.locale()
local P,V,C,Ct,S,R,Cg,Cc =
lpeg.P, lpeg.V, lpeg.C, lpeg.Ct, lpeg.S, lpeg.R, lpeg.Cg, lpeg.Cc
local ws = S'\r\n\f\t\v '
local ws0 = ws^0
local ws1 = ws^1
local name = S'_ ' + L.digit + L.alpha
@soulik
soulik / os_name.lua
Created May 12, 2015 18:23
OS type and CPU architecture detection in Lua language
local function getOS()
local raw_os_name, raw_arch_name = '', ''
-- LuaJIT shortcut
if jit and jit.os and jit.arch then
raw_os_name = jit.os
raw_arch_name = jit.arch
else
-- is popen supported?
local popen_status, popen_result = pcall(io.popen, "")
@soulik
soulik / boot_unpack.lua
Created June 2, 2014 13:20
Android boot image: boot.img unpacker tool written in LuaJIT
local ffi = require 'ffi'
local BOOT_MAGIC = [[ANDROID!]]
local BOOT_MAGIC_SIZE = 8
local BOOT_NAME_SIZE = 16
local BOOT_ARGS_SIZE = 512
local BOOT_EXTRA_ARGS_SIZE = 1024
local t_buf = ffi.new("unsigned char[8]")
@soulik
soulik / generator.lua
Created April 30, 2014 19:22
Mandelbrot set generator in Lua
return singleton(function()
local o = {}
local graphics, surfaces, matrix, bit, complex, color_spaces
local rad = math.rad
o.init = function()
matrix = math.matrix()
surfaces = (require 'EngineB/graphics/textures/surface')()
graphics = (require 'EngineB/graphics')()
complex = require 'utils/complex'
--
-- LPeg-based XML parser.
--
-- * Grammar term names are the same as in the XML 1.1
-- specification: http://www.w3.org/TR/xml11/
-- * Action functions are missing.
--
-- Copyright (C) 2012 Adrian Perez <aperez@igalia.com>
-- Distribute under terms of the MIT license.
--