Skip to content

Instantly share code, notes, and snippets.

View karlvr's full-sized avatar

Karl von Randow karlvr

View GitHub Profile
@karlvr
karlvr / apologies.text
Last active December 17, 2015 00:49 — forked from NZKoz/apologies.text
Dear [First Name],
We're really sorry but our systems were compromised and the attackers
managed to take a copy of your passwords.
The passwords were stored as:
[ ] Bcrypt hashes with a cost factor of X
[ ] PBKDF2 hashes with an iteration count of X
[ ] scrypt because I am Colin Percival
@karlvr
karlvr / jstack-grep
Last active December 20, 2015 13:18
A pattern matching tool for jstack output. Can search for a pattern in the stacktraces, then show details of just the matching threads, either showing all of the stacktrace or just lines matching the search pattern, or matching any other patterns.
#!/usr/bin/perl
#
# A pattern matching tool for jstack output. Can search for a pattern in the stacktraces,
# then show details of just the matching threads, either showing all of the stacktrace or
# just lines matching the search pattern, or matching any other patterns.
#
# For example, to see which threads are currently accessing the database and show the
# stacktrace lines containing your own classes:
# jstack-grep postgres <pid> -i com.xk72
#
#!/bin/bash
# This script automatically sets the version and short version string of
# an Xcode project from the Git repository containing the project.
#
# To use this script in Xcode, add the script's path to a "Run Script" build
# phase for your application target.
set -o errexit
set -o nounset
diff -r bb795f69be65 src/share/classes/com/sun/crypto/provider/DHKeyPairGenerator.java
--- a/src/share/classes/com/sun/crypto/provider/DHKeyPairGenerator.java Sun May 29 14:03:11 2016 +1200
+++ b/src/share/classes/com/sun/crypto/provider/DHKeyPairGenerator.java Sun May 29 16:09:37 2016 +1200
@@ -71,6 +71,17 @@
initialize(1024, null);
}
+ private static void checkKeySize(int keysize)
+ throws InvalidParameterException {
+
--
-- GEOIP IN POSTGRESQL
--
-- We use two approaches. First using PostgreSQL inet and cidr types and indexing (PostgreSQL 9.4 and later),
-- and then using ip4r (https://github.com/RhodiumToad/ip4r).
-- The performance of ip4r indexes is significantly better than PostgreSQL's own index.
-- An operation that took 42s using ip4r took 47 minutes using PostgreSQL's cidr index.
--
@karlvr
karlvr / 00README.md
Last active April 2, 2017 20:53
init.d startup script for spotify-connect-web
apt-get install -y avahi-utils
@karlvr
karlvr / 00README.md
Last active November 26, 2023 14:21
Roadwarrior configuration for macOS 10.12, iOS 10 and Windows 10 using strongSwan and user certificates

strongSwan setup for Road Warriors on macOS 10.12, iOS 10 and Windows 10

This setup is for remote users to connect into an office/home LAN using a VPN (ipsec). This is based on (but not the same as) the strongSwan documentation and this guide: https://raymii.org/s/tutorials/IPSEC_vpn_with_Ubuntu_16.04.html

I used strongSwan 5.5.1.

apt-get install -y strongswan strongswan-pki
@karlvr
karlvr / immutable-typescript-attempt.ts
Last active June 27, 2018 04:41
Immutable-js Typescript 2.8 attempt
import { Map, fromJS } from 'immutable'
function toImmutable<T>(array: T[]): ImmutableList<T>
function toImmutable<T extends object>(obj: T): ImmutableObject<T>
function toImmutable<T>(value: T): ImmutableObject<T> | ImmutableList<T> {
return fromJS(value)
}
type Diff<T, U> = T extends U ? never : T
@karlvr
karlvr / mopidy-alsamixer-patch.diff
Last active August 11, 2018 22:04
mopidy-alsamixer 1.0.3 patch for logarithmic volume
diff --git a/mopidy_alsamixer/__init__.py b/mopidy_alsamixer/__init__.py
index 8f4312a..8916efa 100644
--- a/mopidy_alsamixer/__init__.py
+++ b/mopidy_alsamixer/__init__.py
@@ -22,6 +22,9 @@ class Extension(ext.Extension):
schema = super(Extension, self).get_config_schema()
schema['card'] = config.Integer(minimum=0)
schema['control'] = config.String()
+ schema['min_volume'] = config.Integer(minimum=0, maximum=100)
+ schema['max_volume'] = config.Integer(minimum=0, maximum=100)
@karlvr
karlvr / migrate-nexus-to-github-packages.md
Last active October 25, 2023 12:20
A small bash script to migrate Maven packages from Sonatype Nexus to GitHub Packages

Migrate Maven packages from Sonatype Nexus to GitHub Packages

This gist describes the process we've used to migrate our Maven package repository from Sonatype Nexus to GitHub Packages. The same process could be used for migrating any Maven package repo that is in the standard layout.

We created a special repository on GitHub to hold all of our Maven packages. You might decide to migrate packages to different repositories, in which case invoke the script multiple times.

The script uses find to look for all of the folders containing poms and upload them. You specify the folder