Skip to content

Instantly share code, notes, and snippets.

View gilgamez's full-sized avatar

Gilgamesh Nootebos gilgamez

  • The Netherlands
View GitHub Profile
@gilgamez
gilgamez / uninstall_snap.sh
Created February 27, 2021 10:16
Uninstall Snap Camera
launchctl remove com.snap.AssistantService
sudo rm -f ~/Library/LaunchAgents/com.snap.AssistantService.plist
rm -r ~/Library/Caches/Snap/Snap\ Camera
rm -r ~/Library/Preferences/Snap/Snap\ Camera
osascript -e 'do shell script "launchctl remove com.snap.SnapCameraRemover; rm /Library/LaunchDaemons/com.snap.SnapCameraRemover.plist; rm -r /Library/CoreMediaIO/Plug-Ins/DAL/SnapCamera.plugin; exit 0" with administrator privileges'
name: Snippet UI
layerType: interactie
locatedAt: Hoorn
description: Vulputate Cursus Ligula Vestibulum Ipsum
status: gewenst
technologyStack: yaml
repositoryURL: https://gist.github.com/gilgamez
dockerImage: scratch
organisationName: Example
contact: po@example.com

Keybase proof

I hereby claim:

  • I am gilgamez on github.
  • I am gilgamesh (https://keybase.io/gilgamesh) on keybase.
  • I have a public key ASAhEF_oRwZ44BBiUYItOZi2UVMfiy_bJOSiIPwZ0EXWBwo

To claim this, I am signing this object:

@gilgamez
gilgamez / log-with-supplier
Created January 8, 2019 15:04
wrapper method that evaluates toString dynamically, useful in performance sensitive logging
#!java --source 11
import java.util.function.Supplier;
import java.util.List;
import java.io.File;
import java.io.IOException;
import java.nio.file.Files;
import java.util.stream.Stream;
public class LogWithSuplier {
@gilgamez
gilgamez / gist:00fc127e7afc2ec4598f2c5066e835b9
Created July 12, 2016 14:03 — forked from eduardocardoso/gist:82a629882ddb02ab3677
Script to delete exited containers and untagged/unused images from docker
#!/bin/bash
set -o errexit
echo "Removing exited docker containers..."
docker ps -a -f status=exited -q | xargs -r docker rm -v
echo "Removing dangling images..."
docker images --no-trunc -q -f dangling=true | xargs -r docker rmi
@gilgamez
gilgamez / reject-if-undefined.js
Created June 14, 2016 11:40
Promise reject if falsey
const rejectIfUndefined = (value, E = Error, message = '') => new Promise((resolve, reject) => {
if (value) {
resolve(value);
} else {
reject(new E(message));
}
});
#!/bin/bash
usage ()
{
cat <<UsageHERE
boot2docker-fwd -- Helper function to quickly manage port forwards between the boot2docker-vm and the host
Usage: boot2docker-fwd [ -n RULE_NAME ] [ -h HOST_PORT ] [ -p {tcp|udp} ] [ -i HOST_IP ] GUEST_PORT
or boot2docker-fwd -d RULE_NAME
or boot2docker-fwd -l
or boot2docker-fwd -A

Requirements

  • Docker Machine + Docker
  • curl
  • A Virtualbox-driven Docker Machine called "default" docker-machine create --driver virtualbox default (this is the default with Docker toolkit).

Usage

The git.io URL (https://git.io/v2tb5) is a shortened form of the raw url of the plist.

@gilgamez
gilgamez / unique
Created December 17, 2013 11:01
awk/shell script that filters its input and only outputs identical lines once
#!/bin/sh
IN=${1:--}
OUT=${2:-/dev/tty}
# see http://stackoverflow.com/questions/11532157/unix-removing-duplicate-lines-without-sorting#11532197
awk '!x[$0]++' $IN >$OUT
@gilgamez
gilgamez / my_sshuttle
Last active December 28, 2015 09:49
my companion script to kick a sshuttle session into action. sshuttle is here https://github.com/apenwarr/sshuttle
#!/bin/bash
SSH_SERVER=<some host config ssh understands>
VERBOSITY=-v
cat <<-EOF |
# My Project
172.16.103.183/29 # buildserver
172.16.228.219/28 # issuetracker
172.16.228.246/26 # test