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 chromedp_bug.go
package main
import (
"context"
"fmt"
"net/url"
"time"
"github.com/chromedp/cdproto/cdp"
"github.com/chromedp/chromedp"
@kjk
kjk / build_files.go
Created Jul 19, 2019
build list of files as compact json from directory
View build_files.go
package main
import (
"encoding/json"
"fmt"
"io/ioutil"
"os"
"path/filepath"
)
View keybase.md

Keybase proof

I hereby claim:

  • I am kjk on github.
  • I am kjksf (https://keybase.io/kjksf) on keybase.
  • I have a public key ASAdCRkKmAhWMJJsU_q76BM_JyYK5-MZMrwrr6qTOk3WEwo

To claim this, I am signing this object:

@kjk
kjk / fakemenu.c
Created May 19, 2019
how to implement menu-like pop-up the right way in win32
View fakemenu.c
/*****************************************************************************
*
* FakeMenu.c
*
* Copyright (c) 1997 Microsoft Corporation. All rights reserved.
*
* This source code is only intended as a supplement to
* Microsoft Development Tools, q.v. for detailed
* information regarding the Microsoft samples programs.
*
View program_version.py
#!/usr/bin/env python
# This code was written by Krzysztof Kowalczyk (http://blog.kowalczyk.info)
# and is placed in public domain.
def v2fhelper(v, suff, version, weight):
parts = v.split(suff)
if 2 != len(parts):
return v
version[4] = weight
@kjk
kjk / cmd-git-log.go
Created Mar 21, 2019
Compare output of 2 git log --format=oneline commands to see commits unique in each branch
View cmd-git-log.go
package main
import (
"bytes"
"fmt"
"io/ioutil"
"strings"
)
/*
View log_notion_requests.js
const puppeteer = require("puppeteer");
let waitTime = 5 * 1000;
async function testAjax() {
const url = "https://www.notion.so/Test-page-all-c969c9455d7c4dd79c7f860f3ace6429"
const browser = await puppeteer.launch();
const page = await browser.newPage();
await page.setRequestInterception(true);
// those we don't want to log because they are not important
View latency.markdown

Latency numbers every programmer should know

1 typical CPU instruction ..................   1 ns
L1 cache reference ......................... 0.5 ns
Branch mispredict ............................ 5 ns
L2 cache reference ........................... 7 ns
Mutex lock/unlock ........................... 25 ns
Main memory reference ...................... 100 ns             
Compress 1K bytes with Zippy ............. 3,000 ns  =   3 µs
Send 2K bytes over 1 Gbps network ....... 20,000 ns  =  20 µs
SSD random read ........................ 150,000 ns  = 150 µs
View hello_world.go
package main
import "fmt"
func main() {
fmt.Println("Hello, 世界")
}
@kjk
kjk / reflect_slice.go
Created Aug 31, 2018
How to create a reflect slice
View reflect_slice.go
package main
import (
"fmt"
"log"
"reflect"
)
type S struct {
N int
You can’t perform that action at this time.