Skip to content

Instantly share code, notes, and snippets.

@greatwolf
greatwolf / mkl_rt.def
Created November 5, 2013 23:19
mk_rt.def for creating bcc compatible import lib
LIBRARY MKL_RT.DLL
EXPORTS
_CAXPBY = CAXPBY
_CAXPY = CAXPY
_CAXPYI = CAXPYI
_CBBCSD = CBBCSD
_CBDSQR = CBDSQR
_CCOPY = CCOPY
_CDOTC = CDOTC
@greatwolf
greatwolf / exp.lua
Last active January 22, 2020 20:48
--[[
Simple arithmetic expression parser
using LPeg with re module
--]]
require 'table.clear' -- luajit extension
local dprint = dbg and print or function() end
local dump = require 'pl.pretty'.dump
local re = require 're'
re.updatelocale()
@greatwolf
greatwolf / bdd.cpp
Last active August 29, 2015 14:24
BDD test implementation
#include <iostream>
#include <vector>
using namespace std;
#define Describe(unitgroup) \
struct unitgroup; \
register_harness<unitgroup> unitgroup ## _registered; \
struct unitgroup : public testharness<unitgroup> \
@greatwolf
greatwolf / NQueens.lua
Last active August 29, 2015 14:24
NQueens in lua
local dump = require 'pl.pretty'.dump
local function printboard(board)
if not board then return end
local n = #board
io.stdout:write ("\n", (" -"):rep(n), "\n")
for i = 1, n do
io.stdout:write "|"
for j = 1, n do
io.stdout:write(board[j][i] and "Q" or " ", "|")
local seq = require 'pl.seq'
local function bench (n, func, ...)
assert (n > 0)
assert (type(func) == 'function')
local start = os.clock ()
if n % 2 == 1 then
func (...)
n = n - 1
@greatwolf
greatwolf / copyvstools.bat
Last active February 28, 2017 04:28
Modified batch for extracting Visual Build Tools 2017 into standalone
@echo off& setlocal& set x86=& set w32=system32
rem http://paulhoule.com/msvc14/copymsvc14.bat May 28, 2016
if "%~1"=="" echo Copies minimal files to run CL 14.0 (32 and 64 bit)
if "%~1"=="" echo First arg must be target directory& goto :eof
if exist "c:\Program Files (x86)\." set "x86= (x86)"& set w32=syswow64
rem set vs1=c:\Program Files%x86%\Microsoft Visual Studio 14.0
set vs1=c:\Program Files%x86%\Microsoft Visual Studio\2017\BuildTools\VC\Tools\MSVC\14.10.24930
set vs2=c:\Program Files%x86%\Windows Kits\10
set vs3=c:\Program Files%x86%\Windows Kits\8.1
-- Monte Carlo Simulation of state machine in paper
-- Make one attempt to reach state 1000, fail at zero
function attempt (p)
local state = 2
local ups = 1
while state > 0 do
if state > 1000 then
-- attempt succeeded
@greatwolf
greatwolf / luacom-scm.moteus-1.rockspec
Created January 31, 2020 05:16
LuaCOM rockspec modified to build with CMake.
package = "LuaCOM"
version = "scm.moteus-1"
source = {
url = "https://github.com/moteus/luacom/archive/master.zip",
dir = "luacom-master",
}
description = {
summary = "Use COM libraries from Lua",
detailed = [[
LuaCOM is an add-on library to the Lua language that allows Lua programs to use and implement objects that follow Microsoft's Component Object Model (COM) specification and use the ActiveX technology for property access and method calls. ]],

Keybase proof

I hereby claim:

  • I am greatwolf on github.
  • I am greatwolf (https://keybase.io/greatwolf) on keybase.
  • I have a public key whose fingerprint is D92A 7BD0 33DD 16FF E492 C6F7 949E 25AC 2A21 57D4

To claim this, I am signing this object:

@greatwolf
greatwolf / patch_konsolecursor.lua
Last active June 30, 2023 06:47
Lua script to force KDE Konsole to use a blinking vertical I cursor shape by default.
#!/usr/bin/lua
--[[
Intended for SteamOS v3.4.8 build 20230508.1.
Usage:
sudo steamos-readonly disable
sudo chmod +x patch_konsolecursor.lua
sudo patch_konsolecursor.lua /usr/lib/libkonsoleprivate.so.22.08.2
sudo steamos-readonly enable