Skip to content

Instantly share code, notes, and snippets.

@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 / Cheatsheet.md
Created August 25, 2013 09:30
Markdown files that send to convert via Github API with python 3 urllib. The `gfm.py Sample.md` got fine result. The `gfm.py Cheatseet.md` would get 'BadStatusLine'.

Sample Markdown Cheat Sheet

This is a sample markdown file to help you write Markdown quickly :)

If you use the fabulous [Sublime Text 2/3 editor][ST] along with the [Markdown Preview plugin][MarkdownPreview], open your ST2 Palette with CMD+P then choose Markdown Preview in browser to see the result in your browser.

Text basics

this is italic and this is bold . another italic and another bold

@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 / build.sh
Created October 14, 2014 14:25
iOS build script
# Unlock keychain
security unlock-keychain -p jenkins /Users/jenkins/Library/Keychains/login.keychain
# Build and sign app
xcodebuild -configuration Distribution clean build
# Set variables
APP_PATH="$PWD/build/Distribution-iphoneos/iPadApp.app"
VERSION=`defaults read $APP_PATH/Info CFBundleShortVersionString`
REVISION=`defaults read $APP_PATH/Info CFBundleVersion`
@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 / FL_WinSDK_SetEnv_Cmd
Created November 1, 2015 06:47
setenv.cmd
@ECHO OFF
:: --------------------------------------------------------------------------------------------
:: File : SetEnv.cmd
::
:: Abstract: This batch file sets the appropriate environment variables for the Windows SDK
:: build environment with respect to OS and platform type.
::
:: Usage : Setenv [/Debug | /Release][/x86 | /x64 | /ia64 ][/vista | /xp | /2003 | /2008 | /win7][-h | /?]
::
:: /Debug - Create a Debug configuration build environment
@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!'