Skip to content

Instantly share code, notes, and snippets.

@bcleenders
bcleenders / in-place-dualstack-upgrade.sh
Created August 11, 2023 21:35
Upgrade a GCP instance group to dual-stack, without restarting/recreating the instances
# Steps to switch a GCE pool from single-stack IPv4 to dual-stack.
#
# These steps avoid recreating VMs in a pool; it happens in-place.
# Step 1: Switch all existing VMs in the pool
# (run once per instance in the group)
curl --request PATCH \
'https://compute.googleapis.com/compute/v1/projects/my-project/zones/europe-west1-b/instances/instance-1234/updateNetworkInterface?networkInterface=nic0' \
--header "Authorization: Bearer $(gcloud auth print-access-token)" \
--header 'Accept: application/json' \
@bcleenders
bcleenders / full-disk-encryption-arch-uefi.md
Created March 17, 2022 20:12 — forked from huntrar/full-disk-encryption-arch-uefi.md
Arch Linux Full-Disk Encryption Installation Guide [Encrypted Boot, UEFI, NVMe, Evil Maid]

Arch Linux Full-Disk Encryption Installation Guide

This guide provides instructions for an Arch Linux installation featuring full-disk encryption via LVM on LUKS and an encrypted boot partition (GRUB) for UEFI systems.

Following the main installation are further instructions to harden against Evil Maid attacks via UEFI Secure Boot custom key enrollment and self-signed kernel and bootloader.

Preface

You will find most of this information pulled from the Arch Wiki and other resources linked thereof.

Note: The system was installed on an NVMe SSD, substitute /dev/nvme0nX with /dev/sdX or your device as needed.

### Keybase proof
I hereby claim:
* I am bcleenders on github.
* I am bcleenders (https://keybase.io/bcleenders) on keybase.
* I have a public key ASBhvcaPePT9ms4HhslEqWUIbW76wTVrS_tzfrXAZHSF1go
To claim this, I am signing this object:
-----BEGIN PGP PUBLIC KEY BLOCK-----
mQINBF2x/UoBEACr3xy3vZiQll7I+AubZrP7CUBCLjiQq2jWTKNgGyBTgrG7SiVB
XY9EYPk+Vr1mV3xIeGOzdWjlIAvyAMA7MkeVGjU09sgzYA/KYaJBvRxwgXXoGDwd
igcgei3qd+MMkK7YnG+qLz8y31nKZ0ZCyJxBXsS91MBvsSu+Gl2OU6qEOrUphYK4
nVFPWvl2qbuvf5rIwlk0TGqtKKipPzJ5KDlvuyDwcE+aqzUq9L2DvirZTpduHefY
6gTS68dDGnqHJlCSegnbGyoe1rCqJUkoaWGFHesbSzZuV/FdfsB8Db1gKipqmkXK
AcRZUL+0ELJR4gnften3CyPw66pJ16NBh4B8eg2N1iFZaMhK035n1Le0q+/flxW9
Y2k0Gw9JmKHXc5lOuzSwsTEwbTnbCDNckGCaIVYQ9MObRWf2/pSVw2UmSVYw+xWX
rDSvKrZO8ePtEUOuzAohIXIf6gJRKM2B6Im+eEBONdlsunNgV0YhHi3b93t/2PmD
There are 24 squads using datacounters:
ask - 5
creator - 31
datawhy - 3
favorite - 1
growth-insights - 5
inferno - 7
labianchin - 5
payment-servers - 4
performance-squad - 5
# I like tunning the colors of the prompt in the first place:
export CLICOLOR='true'
export LSCOLORS="gxfxcxdxbxCgCdabagacad"
export EDITOR=vi
# Git branch in good-looking prompt.
parse_git_branch() {
git branch 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/ (\1)/'
}
#!/usr/bin/python
#
# $Id: arc_summary.pl,v 388:e27800740aa2 2011-07-08 02:53:29Z jhell $
#
# Copyright (c) 2008 Ben Rockwood <[email protected]>,
# Copyright (c) 2010 Martin Matuska <[email protected]>,
# Copyright (c) 2010-2011 Jason J. Hellenthal <[email protected]>,
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
@bcleenders
bcleenders / gist:f450621e3f8d828ef755
Last active January 4, 2016 23:51
Multi model translation & benchmarking
# Translate using a multiple models and a translation matrix
# Uses a translation matrix to convert the word-vector from one language to the other
# i.e. vec("koning")*matrix = vec("king")
import sys
import getopt
import collections
import random
import numpy as np
from utils import read_dict, train_tm, apply_tm, score, get_valid_data
Logged in as: dr.who
Logs for container_1447234668707_0019_01_000001
About Apache Hadoop
ResourceManager
RM Home
NodeManager
Tools
[word2vec@bbc1 bin]$ ./hdfs dfs -ls -h /word2vec/output_2007.txt/data
15/11/07 19:31:57 INFO [main] (UniqueNames.java:uniqueName(53)) - adding name to map UgiMetrics
15/11/07 19:31:57 WARN [main] (NativeCodeLoader.java:<clinit>(62)) - Unable to load native-hadoop library for your platform... using builtin-java classes where applicable
Found 4 items
-rw-r--r-- 3 word2vec supergroup 0 2015-11-07 18:55 /word2vec/output_2007.txt/data/_SUCCESS
-rw-r--r-- 3 word2vec supergroup 359 2015-11-07 18:55 /word2vec/output_2007.txt/data/_common_metadata
-rw-r--r-- 3 word2vec supergroup 615 2015-11-07 18:55 /word2vec/output_2007.txt/data/_metadata
-rw-r--r-- 3 word2vec supergroup 9.4 M 2015-11-07 18:55 /word2vec/output_2007.txt/data/part-r-00000-ad0f2eec-1a98-4c9d-8fe3-a9ac4f38172a.gz.parquet