Skip to content

Instantly share code, notes, and snippets.

View pg9182's full-sized avatar
💤
taking a break

pg9182

💤
taking a break
View GitHub Profile
[includeIf "gitdir/i:~/p/ns/"]
path = ~/p/ns/.gitconfig
@pg9182
pg9182 / docker-compose.yaml
Last active May 4, 2023 05:57
Modern docker-compose example for Northstar.
# example docker-compose configuration for Northstar
# - Docker Compose v1.29.0+
# - Northstar v1.13.0+
# this name is used as a prefix for containers
name: nsdedi
# common configuration
x-ns: &ns
<# ::
@@ setlocal disabledelayedexpansion
@@ powershell -NoProfile -ExecutionPolicy Bypass -Command "Invoke-Expression (Get-Content -Raw '%~f0')"
@@ if errorlevel 1 pause
@@ exit /b %errorlevel%
#>
$tf2 = (Get-ItemProperty -Path "HKLM:\SOFTWARE\Respawn\Titanfall2")."Install Dir"
Get-ChildItem $tf2 -Filter "*.starpak" -Recurse |
Where-Object Length -GT 1mb |
@pg9182
pg9182 / ps-polyglot.bat
Created March 21, 2023 23:51
Batch polyglot wrapper for a PowerShell script to bypass ExecutionPolicy and pause on error. Does not support arguments. Works with all PowerShell versions.
<# ::
@@ setlocal disabledelayedexpansion
@@ powershell -NoProfile -ExecutionPolicy Bypass -Command "Invoke-Expression (Get-Content -Raw '%~f0')"
@@ if errorlevel 1 pause
@@ exit /b %errorlevel%
#>
echo test
exit 1
package synx
import (
"bytes"
"errors"
"fmt"
"runtime/debug"
)
// Use errors.Is to test for these errors.
// Package wm provides utilities for working with Web Mercator slippy map
// projections.
//
// See:
// - https://developers.google.com/maps/documentation/javascript/examples/map-coordinates
// - https://wiki.openstreetmap.org/wiki/Slippy_map_tilenames
// - https://basemaps.cartocdn.com
package wm
import (
@pg9182
pg9182 / no_vnc_titlebar.c
Created October 14, 2022 22:06
VNC Viewer doesn't need a titlebar...
#include <stdio.h>
#include <stdlib.h>
#define WIN32_LEAN_AND_MEAN
#include <windows.h>
#include <winuser.h>
int main() {
HWND w = FindWindowA("vwr::CDesktopWin", NULL);
if (!w) {
@pg9182
pg9182 / pdef.go
Last active October 2, 2022 16:01
Titanfall 2 pdef parser.
// Package pdef parses Titanfall 2 player data definitions.
package pdef
import (
"bufio"
"fmt"
"io"
"regexp"
"strconv"
"strings"
#include <stdio.h>
#include <stdlib.h>
#define WIN32_LEAN_AND_MEAN
#include <windows.h>
#include <winuser.h>
int main() {
char cmd[4096];
while (fgets(cmd, sizeof(cmd), stdin)) {
@pg9182
pg9182 / vpk.go
Last active February 20, 2022 13:59
// Package tf2vpk manipulates Titanfall 2 VPKs.
package tf2vpk
import (
"bufio"
"encoding/binary"
"fmt"
"io"
"sort"
"strings"