Skip to content

Instantly share code, notes, and snippets.

@wouterd
wouterd / backup-keys.sh
Created January 6, 2021 10:56
Password-store scripts
#!/bin/bash -eu
TMP_DIR="$(mktemp -d)"
gpg --export-ownertrust > "${TMP_DIR}/gpg-ownertrust.txt"
gpg --export-secret-key -a "MY EMAIL HERE" > "${TMP_DIR}/private-key.txt" || true
cp -r ~/.ssh "${TMP_DIR}/"
cd "${TMP_DIR}"
@wouterd
wouterd / shell-oneliners.md
Created November 1, 2017 13:14
Shell Oneliners

Find all git repos that have local changes that need pushing

find . -name .git | xargs -I % sh -c " git -C %/.. diff --exit-code > /dev/null || echo % "

Keybase proof

I hereby claim:

  • I am wouterd on github.
  • I am wouterd (https://keybase.io/wouterd) on keybase.
  • I have a public key whose fingerprint is 4FD8 2922 A5C4 290E E866 FE98 F0A5 0EBB 7CB7 7D41

To claim this, I am signing this object:

@wouterd
wouterd / ie_json_script_injection.json
Created July 2, 2015 16:12
Shows a JSON that lets Internet Explorer execute Javascript
{
"title":"<img src=# onerror='alert(11)'>"
}

Keybase proof

I hereby claim:

  • I am wouterd on github.
  • I am wouterd (https://keybase.io/wouterd) on keybase.
  • I have a public key whose fingerprint is 4EB3 3911 580A 2C21 1981 ED03 4569 9580 E78F 15F1

To claim this, I am signing this object:

@wouterd
wouterd / package.json
Created May 8, 2014 21:35
Dyndns replacement using Cloudflare, run `npm install`, then `node update-cloudflare.js`
{
"name": "dynamic-ip",
"version": "0.0.1",
"description": "A tool to update cloudflare with my dynamic IP",
"main": "update.js",
"dependencies": {
"fn.js": "~0.7.0",
"sequence": "~3.0.0",
"restler": "~3.2.2"
},
@wouterd
wouterd / defaultread.xml
Last active August 29, 2015 13:57
Addition to Hippo's defaultread domain to allow users to read their own groups.
<?xml version="1.0" encoding="UTF-8"?><sv:node xmlns:sv="http://www.jcp.org/jcr/sv/1.0" xmlns:h="http://www.onehippo.org/jcr/xmlimport" sv:name="defaultread" h:merge="combine">
<sv:node sv:name="mygroups">
<sv:property sv:name="jcr:primaryType" sv:type="Name">
<sv:value>hipposys:domainrule</sv:value>
</sv:property>
<sv:node sv:name="match-members-with-username">
<sv:property sv:name="jcr:primaryType" sv:type="Name">
<sv:value>hipposys:facetrule</sv:value>
</sv:property>
<sv:property sv:name="hipposys:equals" sv:type="Boolean">
@wouterd
wouterd / ParrallelTest.java
Created March 19, 2014 16:00
Testing parrallel vs serial filtering in Java8
import java.util.ArrayList;
import java.util.List;
import java.util.Random;
/**
* Created by wouter on 19-03-14.
*/
public class ParrallelTest {
public static final int SET_SIZE = 1000000;
public class SubjectHstSiteMapHandler extends ContentBeanAwareHstSiteMapItemHandler {
private static final Logger LOGGER = LoggerFactory.getLogger(SubjectHstSiteMapHandler.class);
@Override
public ResolvedSiteMapItem process(ResolvedSiteMapItem resolvedSiteMapItem,
HttpServletRequest request,
HttpServletResponse response)
throws HstSiteMapItemHandlerException {
HippoBean contentBean = getContentBeanForResolvedSiteMapItem(resolvedSiteMapItem);
if (contentBean == null) {
LOGGER.info("No content bean found, reverting to initial site map item.");
@wouterd
wouterd / Vagrantfile
Last active October 21, 2018 12:17
Vagrant file to setup a 3-server mongo replica set and a script to intialize the mongod cluster
# -*- mode: ruby -*-
# vi: set ft=ruby :
# Vagrantfile API/syntax version. Don't touch unless you know what you're doing!
VAGRANTFILE_API_VERSION = "2"
$mongoInitScript = <<-"SCRIPT"
YUM_REPO_CONFIG_PATH="/etc/yum.repos.d/mongodb.repo"
tee $YUM_REPO_CONFIG_PATH <<-"EOF"