Skip to content

Instantly share code, notes, and snippets.

Krzysztof Kowalczyk kjk

Block or report user

Report or block kjk

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View NoFreeAllocator.cpp
/* Copyright 2014 the SumatraPDF project authors (see AUTHORS file).
License: Simplified BSD (see COPYING.BSD) */
/* NOTE: this is unfinished work in progress */
/* NoFreeAllocator (ScratchAllocator ?) is designed for quickly and easily
allocating temporary memory that doesn't outlive the stack frame
in which it was allocated.
Consider this piece of code:
kjk /
Created Dec 11, 2014
Improving smaz benchmarking


Krzysztofs-MacBook-Pro-4:go-smaz kkowalczyk$ go test -bench=.
BenchmarkCompression	     500	   3451735 ns/op	  39.60 MB/s
BenchmarkDecompression	     500	   2740847 ns/op	  27.58 MB/s


Krzysztofs-MacBook-Pro-4:go-smaz kkowalczyk$ go test -bench=.
View ProgramVersion.cs
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Globalization;
using System.IO;
using System.Text;
/* This code was written by Krzysztof Kowalczyk (
and is placed in public domain. */
kjk / test_gob.go
Created Dec 18, 2013
Shows that one cannot append data to a gob file - the decoder will error out with 'extra data in buffer` when trying to decode data written by append.
View test_gob.go
package main
import (
kjk / show_caller_name.go
Last active Dec 31, 2015
Shows that we can get the caller's function name without access to source code. go build -o test show_caller_name.go; rm show_caller_name.go; ./test
View show_caller_name.go
package main
import (
var (
dunno = []byte("???")
import os
import pefile
# needs to be installed
# i.e. download it, extract and python install
d = os.path.join("win", "Debug")
files = os.listdir(d)
def is_pe(s):
if s.endswith(".dll"):
kjk / windows.h__.js
Created Oct 4, 2016
windows.h.js INFINITY
View windows.h__.js
var ffi = require('ffi'),
ref = require('ref'),
Struct = require('ref-struct'),
Library = require('./Library'),
Type = ref.Type,
NULL = ref.NULL,
isNull = ref.isNull;
var groups = ['libs', 'types', 'structs', 'callbacks', 'enums'];
kjk / 3.5-chromium.txt
Last active Nov 25, 2017
clang-format styles
View 3.5-chromium.txt
kjkmacpro:sumatrapdf kjk$ clang-format -dump-config -style=Chromium
Language: Cpp
# BasedOnStyle: Chromium
AccessModifierOffset: -1
ConstructorInitializerIndentWidth: 4
AlignEscapedNewlinesLeft: true
AlignTrailingComments: true
AllowAllParametersOfDeclarationOnNextLine: false
AllowShortBlocksOnASingleLine: false
View faster_binary_tree.go
package main
import (
You can’t perform that action at this time.