Skip to content

Instantly share code, notes, and snippets.

@torgeir
torgeir / wine-tkg-fsync-arch-build.sh
Created Jun 29, 2022
Wine tkg with fsync support for running helix native on arch
View wine-tkg-fsync-arch-build.sh
# git@github.com:Frogging-Family/wine-tkg-git.git
cd Code/wine-tkg-git/wine-tkg-git
makepkg
# select 0, the customizations has settings for fsync
sudo pacman -U wine-tkg-staging-fsync-git-7.11.r6.gc9652a68-327-x86_64.pkg.tar.xz
@torgeir
torgeir / codingame-snake-ai.kt
Last active Jun 26, 2022
Codingame: Snake AI, random safe moves
View codingame-snake-ai.kt
import java.util.*
import java.lang.Integer.parseInt
typealias Coord = Pair<Int, Int>
fun Coord.x() = first
fun Coord.y() = second
typealias Move = Pair<Direction, Coord>
View resize-bf5.sh
#!/usr/bin/env bash
# https://stackoverflow.com/questions/288512/resizing-a-window-to-a-set-size-in-linux
wmctrl -l
wmctrl -r "Battlefield™ V" -e 0,0,0,1920,1280
@torgeir
torgeir / clojure.ipynb
Last active Feb 20, 2022
clojure.ipynb
View clojure.ipynb
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@torgeir
torgeir / --etc--systemd--system--after-sleep.service
Created Feb 19, 2022
Bring back display after sleep. Keywords: manjaro nvidia lightdm blurlock i3exit xrandr. Double -- in filename means /
View --etc--systemd--system--after-sleep.service
[Unit]
Description=Make the screen come back after waking from suspend
After=suspend.target
[Service]
Type=oneshot
ExecStartPre=/bin/sleep 5s
ExecStart=/home/torgeir/bin/after-sleep.sh
[Install]
@torgeir
torgeir / js-map-set-complex-objects.js
Created Feb 16, 2022
Js Map and Sets for complex objects
View js-map-set-complex-objects.js
var o = {}
var m = new Map()
m.set(o, 42)
m.get({}) // undefined
m.get(o) // 42
var s = new Set()
s.add(1)
s.add(2)
s.add(2)
View linux-test-disk-write-speed.sh
dd if=/dev/zero of=test.img bs=1G count=5 oflag=dsync && rm test.img
# 5+0 records in
# 5+0 records out
# 5368709120 bytes (5,4 GB, 5,0 GiB) copied, 3,69591 s, 1,5 GB/s
@torgeir
torgeir / wine-helix-native-vst.log
Created Jul 11, 2021
Wine installing Helix Native 3.11 on Ubuntu Studio 21.01 with wine-staging 6.12
View wine-helix-native-vst.log
# Install a bunch of Windows DLLs needed to make Native work
# https://ubuntuhandbook.org/index.php/2021/05/wine-6-9-released-install-in-ubuntu-21-04-20-04/
sudo apt install --install-recommends winehq-staging
wine 'wineboot'
sudo apt install winetricks
winetricks vcrun2013 gdiplus urlmon
wine $PWD/Downloads/HelixNativev3.11Installer.exe
# install yabridge and follow its installation instructions
# linux reaper will find the vts3 version
@torgeir
torgeir / org-w3c-dom-serializer.kt
Created Jul 8, 2021
Org w3c dom serializer xml node to string kotlin
View org-w3c-dom-serializer.kt
// https://xerces.apache.org/xerces2-j/faq-dom.html
private val loadSaveSerializer by lazy {
val registry = DOMImplementationRegistry.newInstance()
val domImplementation = registry.getDOMImplementation("LS") as DOMImplementationLS
domImplementation.createLSSerializer()
}
loadSaveSerializer.writeToString(..)
@torgeir
torgeir / bigquery-geojson-with-properties.json
Last active Jun 23, 2021
Geojson with properties, extracted from bigquery
View bigquery-geojson-with-properties.json
[
{
"json": "{\"type\":\"MultiLineString\",\"coordinates\":\"[[[11.36588,61.13079], ... , [11.007229,61.572116]]]\",\"properties\":{\"description\":\"Stengt på grunn ... . \"}}"
},
...
{
"json": "{\"type\":\"LineString\",\"coordinates\":\"[[10.402729,62.429979], ... ,[10.335529,62.561779]]\",\"properties\":{\"description\":\"Stengt på grunn ... .\"}}"
}
]