Skip to content

Instantly share code, notes, and snippets.

View se35710's full-sized avatar

Mathias Hermansson se35710

  • Göteborg, Sweden
View GitHub Profile
@se35710
se35710 / generate-rfc4193-address
Last active November 9, 2024 17:32
Script that generates a unique local address (ULA) with a /48 prefix using a Pseudo-Random Global ID Algorithm from RFC 4193
#!/bin/bash
# The script generates a unique local address (ULA) with a /48 prefix
# using a Pseudo-Random Global ID Algorithm from RFC 4193
PATH=/usr/local/bin:/bin:/usr/bin:/usr/sbin:/sbin
DEBUG=0
log () {
if [ ! -z "${DEBUG}" ] && [ "${DEBUG}" == "1" ]; then
echo "$1" >&2
@se35710
se35710 / en_SE
Created August 8, 2018 11:40
en_SE locale
comment_char %
escape_char /
% This file is part of the GNU C Library and contains locale data.
% The Free Software Foundation does not claim any copyright interest
% in the locale data contained in this file. The foregoing does not
% affect the license of the GNU C Library as a whole. It does not
% exempt you from the conditions of the license if your use would
% otherwise be governed by that license.
param($dir)
# First extraction (until extract_to supports 7zip)
mkdir -p "$dir\_tmp" >$null
$output = 7z x "$dir\dl.exe" "-o$dir\_tmp"
# Java Source (src.zip)
$output = 7z x "$dir\_tmp\.rsrc\1033\JAVA_CAB9\110" "-o$dir"
# JDK (tools.zip)
$output = 7z x "$dir\_tmp\.rsrc\1033\JAVA_CAB10\111" "-o$dir"
@se35710
se35710 / apt-mirror.sh
Created December 4, 2017 22:12
Replace archive.ubuntu.com in sources.list with fastest mirror
sed -i 's/http:\/\/archive.ubuntu.com\/ubuntu\//mirror:\/\/mirrors.ubuntu.com\/mirrors.txt/g' /etc/apt/sources.list
@se35710
se35710 / find-java.ps1
Last active November 25, 2023 18:08
PowerShell script to locate Java on Windows, optionally sets JAVA_HOME and JRE_HOME.
<#
.SYNOPSIS
Locates Java versions and optionally sets JAVA_HOME and JRE_HOME.
.DESCRIPTION
The Find-Java function uses PATH, JAVA_HOME, JRE_HOME and Windows Registry to retrieve installed Java versions.
If run with no options, the first Java found is printed on the console.
.PARAMETER Vendor
Selects Java vendor, currently supports Oracle, OpenJDK and IBM. Defaults to Any.
.PARAMETER Architecture
What processor architecture to match. Valid options are 32, 64, Match and All. Match detects what integer size is used for the PowerShell process, and matches the architecture. If Wow64 is available, 64 bit versions of Java are selected first.