Skip to content

Instantly share code, notes, and snippets.

View kjk's full-sized avatar

Krzysztof Kowalczyk kjk

View GitHub Profile
package main
// https://blog.kowalczyk.info/article/wOYk/advanced-command-execution-in-go-with-osexec.html
import (
"bytes"
"fmt"
"log"
"os/exec"
"runtime"
package main
// https://blog.kowalczyk.info/article/wOYk/advanced-command-execution-in-go-with-osexec.html
import (
"fmt"
"log"
"os/exec"
"runtime"
)
package main
// https://blog.kowalczyk.info/article/wOYk/advanced-command-execution-in-go-with-osexec.html
import (
"log"
"os"
"os/exec"
"runtime"
)
package main
// https://blog.kowalczyk.info/article/wOYk/advanced-command-execution-in-go-with-osexec.html
import (
"log"
"os/exec"
"runtime"
)
@kjk
kjk / pdf outline structure.txt
Created February 25, 2020 09:16
PDF outline structure (made with https://codeeval.dev)
/Root dict
/Outlines dict
/First dict
/Title string
/Dest string | name | array | dict
/A dict : action
/First ->
/Count int
/Next dict -> same as First
@kjk
kjk / main.js
Created February 24, 2020 07:57
pdf.js apis (made with https://codeeval.dev)
let doc = await pdfjslib.getDocument(url);
doc.numPages;
let page = await doc.getPage(1);
let viewport = page.getViewport({scale: 1.0});
// viewport.width, viewport.height
var canvas = document.getElementById('the-canvas');
var context = canvas.getContext('2d');
canvas.height = viewport.height;
@kjk
kjk / main.html
Created February 11, 2020 09:15
sumatra crash preview with alpine.js (made with https://codeeval.dev)
<!doctype html>
<httml>
<head>
<style>
html, body {
font-family: monospace;
font-size: 10pt;
}
</style>
<script>
@kjk
kjk / main.go
Created February 1, 2020 20:29
extract translations with regexp (made with https://codeeval.dev)
package main
import (
"fmt"
"regexp"
)
var (
TRANSLATION_PATTERN = regexp.MustCompile(`\b_TRN?\("(.*?)"\)`)
)
@kjk
kjk / c_cpp_properties.json
Created January 21, 2020 03:55
vscode cpp intellisense settings (made with https://codeeval.dev)
{
"configurations": [
{
"name": "Win32",
"includePath": [
"${workspaceRoot}/src",
"${workspaceRoot}/src/util",
"${workspaceRoot}/src/wingui"
],
"defines": [
@kjk
kjk / main.go
Last active January 20, 2020 09:32
Value vs. pointer receiver (made with https://codeeval.dev)
// :collection Essential Go
package main
import (
"fmt"
)
// :show start
type Foo struct {
Str string