Skip to content

Instantly share code, notes, and snippets.

@dylanmei
dylanmei / extract ms packages
Last active October 10, 2022 00:04
How to extract msu/msp/msi/exe files from the command line
http://www.windowswiki.info/2009/02/19/how-to-extract-msumspmsiexe-files-from-the-command-line/
I find these commands quite helpful — maybe you know them already — if not, here you go:
Microsoft Hotfix Installer (.exe)
setup.exe /t:C:<target_dir> /c
Microsoft Update Standalone Package (.msu)
expand -F:* update.msu C:<target_dir>
cd <target_dir>
@dylanmei
dylanmei / Justfile
Created November 14, 2021 16:54
Install kotlin-language-server
install: clean
./gradlew :server:distZip
@cd server/build/distributions && unzip server.zip
@rm -rf ~/.local/share/kotlin-language-server
mv server/build/distributions/server \
~/.local/share/kotlin-language-server
clean:
./gradlew :server:clean
@dylanmei
dylanmei / pgn.kt
Created September 9, 2019 14:06
Parse PGN chess database files
import java.io.File
import java.io.Reader
import java.io.StringReader
import java.io.BufferedReader
import kotlin.sequences.*
import kotlin.collections.*
data class Match(
val event: String,
@dylanmei
dylanmei / csv-to-json
Created March 25, 2014 13:50
CSV to JSON in Groovy
import groovy.json.*
if (args.size() == 0) {
println("missing argument")
System.exit(1)
}
def f = new File(args[0])
if (!f.exists()) {
println("file doesn't exist")
@dylanmei
dylanmei / archlinux_from_usb.md
Last active December 23, 2017 20:18
Archlinux from USB
@dylanmei
dylanmei / Haproxy logstash to StatsD
Last active July 25, 2017 21:27
Haproxy logstash to StatsD
input {
tcp {
port => 5140
type => "haproxy"
}
}
filter {
grok {
# break the input "message" into two parts: a priority structure,
@dylanmei
dylanmei / steps.sh
Created June 15, 2017 14:26
simple ss-cert
openssl genrsa -out ca-key.pem 2048
openssl req -x509 -new -nodes -key ca-key.pem -subj "/CN=*" -days 3650 -out ca.pem
openssl genrsa -out telepath-key.pem 2048
openssl req -new -key telepath-key.pem -subj "/CN=telepath" -out telepath.csr
openssl x509 -req -in telepath.csr -CA ca.pem -CAkey ca-key.pem -CAcreateserial -out telepath.pem -days 3650
package main
import (
"fmt"
"io/ioutil"
"log"
"os"
"crypto/tls"
"crypto/x509"
<powershell>
write-output "Running User Data Script"
write-host "(host) Running User Data Script"
# Set TZ
#cmd.exe /c tzutil /s \"Pacific Standard Time\"
cmd.exe /c net user /add packer packer
cmd.exe /c net localgroup administrators packer /add
cmd.exe /c wmic useraccount where "name='packer'" set PasswordExpires=FALSE
@dylanmei
dylanmei / gist:7914583
Created December 11, 2013 17:18
packer-windows - sshd_config - circa november
# $OpenBSD: sshd_config,v 1.89 2013/02/06 00:20:42 dtucker Exp
# This is the sshd server system-wide configuration file. See
# sshd_config(5) for more information.
# This sshd was compiled with PATH=/bin:/usr/sbin:/sbin:/usr/bin
# The strategy used for options in the default sshd_config shipped with
# OpenSSH is to specify options with their default value where
# possible, but leave them commented. Uncommented options change a