Skip to content

Instantly share code, notes, and snippets.

@skissane
skissane / GetPowerRequestList.c
Created March 28, 2023 00:35
Tool to dump CallNtPowerInformation(GetPowerRequestList) results
#define _WIN32_WINNT 0x0602
#define UMDF_USING_NTSTATUS
#include <stdio.h>
#include <windows.h>
#include <powerbase.h>
#include <stdbool.h>
#include <ntstatus.h>
#include <shlobj.h>
#pragma comment(lib, "PowrProf.lib")
@skissane
skissane / installCygwinFedora.sh
Created November 10, 2020 17:18
Install Fedora 33 in chroot on Ubuntu 19.10. Installs Cygwin GCC in the Fedora 33 chroot and tests if it works
#!/bin/bash
set -xue
# Script to install Fedora 33 in a chroot on Ubuntu
# And then in turn install cygwin64-gcc in that chroot
# Finally we test we can compile a .exe with Cygwin
#
# Run this as root
#
# Works on Ubuntu 19.10
<!DOCTYPE html>
<html lang="en" dir="ltr" class="google glue-flexbox spa" locale="ALL_au" user-region="asia-pacific" path="/google-in-australia/an-open-letter/">
<head>
<meta charset="utf-8">
@skissane
skissane / pex_install_postgis_workarounds.md
Last active June 14, 2022 14:17
Solutions and workarounds for issues with "pex install postgis" (assuming macOS+Homebrew)

Problem: configure: error: could not find libxml2
Solution: sudo xcode-select -s /Library/Developer/CommandLineTools

Problem: configure: error: could not find geos-config within the current path. You may need to try re-running configure with a --with-geosconfig parameter
Solution: brew install geos

Problem: configure: error: could not find proj_api.h - you may need to specify the directory of a PROJ.4 installation using --with-projdir
Solution: brew install proj and then CFLAGS=-DACCEPT_USE_OF_DEPRECATED_PROJ_API_H pex install postgis

Problem: configure: error: gdal-config not found. Use --without-raster or try --with-gdalconfig=\

@skissane
skissane / unicode-cldr-json-license-metadata-issue.txt
Created April 18, 2018 15:48
Analysis of an issue with CLDR JSON license metadata
In the Unicode CLDR repositories https://github.com/unicode-cldr
the package.json and bower.json don't declare the software license using proper
SPDX syntax.
This is causing some problems with the WebJars system –
https://www.webjars.org/ – which demands a valid open source license be
declared. (WebJars uses BinTray, and BinTray only allows open source artifacts
to be posted without paying.)
@skissane
skissane / testPrivateKey2.asc
Created January 22, 2018 02:31
Example of PGP private key generated with more standard User ID format
-----BEGIN PGP PRIVATE KEY BLOCK-----
Version: BCPG v1.57
lQcqBFplTKoBEAC3iXUJHke/JHUwKTeNgjA0y43n+2fS1PS+SFg9OpsQ6ys+x6IJ
C5Sy56zPZx8Miq7qKYXdtmhH1d6249MEQ0f/F9P1Pi53Ea82E/xwpBkVPRWjWA7O
V6XebWV8F9aq01Ae8Np7YqLyWBwwWHvUADmDO/QAnvEuG3FXeCz5ruclH9wffnXs
BDuNu3beCDnoVxJRmN90UWBhbsCn573J5yHg+1+Kv3GE4aazDP8NROZZJvDonZ5m
q8pIprj7wCvFJB5zqaJCtt0fpbUdVLUD4vNShew39rmMNdkWqozjHwtfPaPIIHXi
NmB0vIG/h0d0hMxEPkvOoUtfD1HM0/OrNHHPlNwEe2hVg/ylF/1Dur9nkmCyWQzV
pFiTY90pwkeaE7Su60pBkFDeerg4dahHlS4yuE3WbBM6HXfQ72/dqo1oRUSyIU7B
@skissane
skissane / testGpg.sh
Created January 19, 2018 04:51
test encryption/decryption of GPG data using generated key
#!/bin/bash
#
# testGpg.sh - performs test of GPG functionality using generated key
#
# This one-liner switches to script directory respecting symlinks
cd "$([ -L "$0" ] && dirname "$(_link="$0"; while [ -L "${_link}" ]; do _to="$(readlink "${_link}")"; _link="$([[ "${_to}" = /* ]] && echo "${_to}" || echo "$(dirname "${_link}")/${_to}")"; done; echo "${_link}")" || dirname "$0")"
# Routine to display error message and exit
abortMsg() {
@skissane
skissane / testPrivateKey.asc
Created January 19, 2018 04:38
Example of generated private key which produces "Checksum error" in GPG
-----BEGIN PGP PRIVATE KEY BLOCK-----
Version: BCPG v1.57
lQcqBFphcnkBEADEgI6BGjfYBtgrHNjDIrVuiTa8vQcSgOTPP6EOmY/l/+JXxHjI
FjLR1xaKcVaaNEMJ0k1vN35u2KwJiGdJcr60XhJSvUd0ZhC8gcK4trc7ZsWP5Rmb
ws4MiXjWzoqvIOlGS3UuWnc/pGGJz8vtxIFVJWdwVxSfoVduahvsMMUk9efVmSxP
jHKT+iaO2lMqw5vvhKxQS2TJybC5q6cD0s/z5ppZATdPvKCNfNLrwOUzmj2XbjH/
5WaHBVDoJgtmatMV+UAq3gFLpyzQ8+TXBcjF34VplXmoLVOEwXDihNz5gw5aQWlz
fQQx1yz0IxWy+csEZGFvLBE21HuOcTkZF9IxpwxgWNRtJzI0wqaKnfSuhjAmGi5x
PZfuZodEJahvipQ+m9Kib5kb74Tmrsc8+5QOjdruOSOaBvSnbTno06VuMngb6tC4
@skissane
skissane / edit
Created June 14, 2017 22:38
Script to launch vim
#!/bin/bash
if [ "$#" -eq 0 ]; then
count="$(gvim --serverlist | wc -l)"
if [ "$count" -eq 0 ]; then
gvim
else
gvim --remote-send "$(echo -ne '\033:tabe\r')"
fi
else
gvim --remote-tab-silent "$@"