Skip to content

Instantly share code, notes, and snippets.

View baszoetekouw's full-sized avatar

Bas Zoetekouw baszoetekouw

View GitHub Profile
@baszoetekouw
baszoetekouw / gist:291a7d4898a77822861fd6d3bd3f57b5
Created April 13, 2016 12:40
script that works both in /etc/pm/sleep.d and /lib/systemd/system-sleep
#!/bin/sh
set -e
# support both /etc/pm/sleep.d and /lib/systemd/system/sleep arguments
if [ -z "$2" ]
then
# old-style /etc/pm format
if [ "$1" = "suspend" ]; then STAGE="pre"; TYPE="sleep"; fi
#!/bin/bash
#
# This script can be used to generate/renew/refresh Letsencrypt SSL certificates
# Simply edit the config variables below, and run it (as root, or make sure your user has access to write to all approriate directories).
# It depends on acem-tiny (https://github.com/diafygi/acme-tiny) for the actual interaction with the Letsencrypt ACME service
#
set -e
# base dir where Letsencrypt this script is installed and acme-tiny is checked out
@baszoetekouw
baszoetekouw / edugain-entity.sh
Last active September 30, 2016 08:30
Fetch a specific entity from edugain
#!/bin/sh
set -e
MDS=http://mds.edugain.org/
MDSCACHE=/tmp/edugain.mds.xml
MAXAGE=3600
ENTITY=$1
AGE=$(expr $MAXAGE + 1)
if [ -e $MDSCACHE ]; then
@baszoetekouw
baszoetekouw / manip.php
Created July 4, 2017 09:20
OpenConext Attribute manipulation to reconstruct sHO+uid from ePPN
# This attribute manipulation reconstructs a uid and schacHomeOrg
# from an EPPN
$attr_eppn_saml1 = "urn:mace:dir:attribute-def:eduPersonPrincipalName";
$attr_eppn_saml2 = "urn:oid:1.3.6.1.4.1.5923.1.1.1.6";
$attr_uid = "urn:mace:dir:attribute-def:uid";
$attr_sho = "urn:mace:terena.org:attribute-def:schacHomeOrganization";
if ( isset($attributes)
and ($attributes !== FALSE)
#!python3
import datetime
import shutil
import os
import subprocess
# source and destiantion trees
src="/data/Backup/src/test-copy/src"
dst1="/data/Backup/src/test-copy/dst1"
@baszoetekouw
baszoetekouw / remove_bloatware.sh
Last active April 30, 2023 20:24
Bloatware to be removed from Galaxy S8
#!/bin/bash
# dit zijn de paketten die IK van mijn (verder lege) telefoon heb verwijderd.
exit
adb shell pm uninstall -k --user 0 com.android.bio.face.service
adb shell pm uninstall -k --user 0 com.diotek.sec.lookup.dictionary
adb shell pm uninstall -k --user 0 com.enhance.gameservice
adb shell pm uninstall -k --user 0 com.facebook.appmanager
adb shell pm uninstall -k --user 0 com.facebook.katana
adb shell pm uninstall -k --user 0 com.facebook.services
adb shell pm uninstall -k --user 0 com.facebook.system
#include <math.h>
#include <stdio.h>
#include <inttypes.h>
#include <stdlib.h>
#include <unistd.h>
#include <malloc.h>
#include <string.h>
#include <sys/time.h>
int main()
@baszoetekouw
baszoetekouw / wachtwoordmaker.sh
Last active March 26, 2019 08:14
Create a nicely formatted secret
#!/bin/bash
set -e
# defaults
num=24
grp=5
# ugly hack: arithmetric expansion $(()) will return 0 for non-integer arguments
if [ $(($1)) != 0 ]
then
2020/02/28 16:43:15 [INFO] Terraform version: 0.12.21
2020/02/28 16:43:15 [INFO] Go runtime version: go1.13.8
2020/02/28 16:43:15 [INFO] CLI args: []string{"/opt/brew/bin/terraform", "apply", "-parallelism=1"}
2020/02/28 16:43:15 [DEBUG] Attempting to open CLI config file: /Users/bas/.terraformrc
2020/02/28 16:43:15 [DEBUG] File doesn't exist, but doesn't need to. Ignoring.
2020/02/28 16:43:15 [INFO] TF_CLI_ARGS_apply value: "-parallelism=100"
2020/02/28 16:43:15 [INFO] CLI command args: []string{"apply", "-parallelism=100", "-parallelism=1"}
2020/02/28 16:43:15 [TRACE] Meta.Backend: no config given or present on disk, so returning nil config
2020/02/28 16:43:15 [TRACE] Meta.Backend: backend has not previously been initialized in this working directory
2020/02/28 16:43:15 [DEBUG] New state was assigned lineage "7ed3e561-a5f3-9de9-2e23-2732a7ffef87"
@baszoetekouw
baszoetekouw / ldifchecksum.py
Last active March 31, 2020 14:07
script to calculate checksum of an ldif (e.g., slapcat output)
#!/usr/bin/env python3
import sys
import ldif
import hashlib
#import json
import numbers
from typing import Collection, Any
"""