Skip to content

Instantly share code, notes, and snippets.

@xpol
xpol / TFT.lua
Created March 31, 2014 07:09
Create a series of image use to test TFT screen.
-- command line arg:
-- TFT.lua WxH
function check(arg)
if not arg[1] then
error('WxH arg not given!')
end
local w, h = arg[1]:match('(%d+)x(%d+)')
if not w or not h then
error('W or H not number!')
end
@xpol
xpol / stackBlur.js
Created December 1, 2014 09:29
Stack Blur in Javascript
/*
StackBlur - a fast almost Gaussian Blur For Canvas
Version: 0.5
Author: Mario Klingemann
Contact: mario@quasimondo.com
Website: http://www.quasimondo.com/StackBlurForCanvas
Twitter: @quasimondo
@xpol
xpol / notwroking.bat
Created July 26, 2012 04:53
Detect if bat file is running via double click or from cmd window
if %cmdcmdline% == "%SystemRoot%\system32\cmd.exe" (
echo from cmd window...
) else (
pause
)
@xpol
xpol / pack.lua
Last active December 20, 2015 15:29
Packing script for Sublime Text 3 Markdown Preview plugin on windows.
local function parent_directory_name(p)
if not p:find('[/\\]') then return '' end
return p:match('^.-([^/\\]+)[/\\][^/\\]+$')
end
local PKG = parent_directory_name(arg[0])
print(PKG)
local installd = os.getenv('APPDATA')
local filename = string.format('%s\\Sublime Text 3\\Installed Packages\\%s.sublime-package', installd, PKG)
@xpol
xpol / div.md
Last active December 20, 2015 20:39
Html inside fenced-code-blocks
<div></div>
@xpol
xpol / 00_ha_dnscrypt_proxy_client_setup.markdown
Created December 25, 2015 06:51
Highly-available dnscrypt-proxy client setup on OSX with DNSSEC.

Tested, works!

Install

git clone https://gist.github.com/fccbf0f02355a31f7959 && cd fccbf0f02355a31f7959 && sh install.sh && cd .. && rm -rf fccbf0f02355a31f7959

Uninstall

git clone https://gist.github.com/fccbf0f02355a31f7959 && cd fccbf0f02355a31f7959 && sh uninstall.sh && cd .. && rm -rf fccbf0f02355a31f7959

Write-Output 'Good!'
function proxy {
case $1 in
[1-9]*)
export http_proxy=socks5://127.0.0.1:$1
export https_proxy=$http_proxy
git config --global http.proxy $http_proxy
git config --global https.proxy $https_proxy
;;
off)
@xpol
xpol / ProFi.lua
Created January 14, 2016 06:39 — forked from perky/ProFi.lua
ProFi, a simple lua profiler that works with LuaJIT and prints a pretty report file in columns.
--[[
ProFi v1.3, by Luke Perkin 2012. MIT Licence http://www.opensource.org/licenses/mit-license.php.
Example:
ProFi = require 'ProFi'
ProFi:start()
some_function()
another_function()
coroutine.resume( some_coroutine )
ProFi:stop()
#!/usr/bin/env bash
# Install luarocks for luaenv.
function install() {
printf "install luarocks for $1..."
local ROOT=`luaenv root`
if [[ $1 == luajit* ]]; then
./configure --prefix=$ROOT/versions/$1 \
--with-lua=$ROOT/versions/$1 \
--rocks-tree=$ROOT/versions/$1 \