Skip to content

Instantly share code, notes, and snippets.

View mld's full-sized avatar

Micke Löfstrand mld

  • Sweden
View GitHub Profile
@mld
mld / readme.md
Last active March 22, 2023 12:32

Disable webcam microphone in Linux (udev)

Find the device you want to disable

$ lsusb
...
Bus 001 Device 016: ID 046d:082d Logitech, Inc. HD Pro Webcam C920
...

Grab the vendor (046d) and product (082d).

@mld
mld / readme.md
Last active January 25, 2023 12:34
Keep Ansible Vault keyfile GPG-encrypted

Keep Ansible Vault keyfile GPG-encrypted

Encrypt the vault pass and save it to ~/.vault.gpg

Make sure to use your own e-mail address as recipient.

$ echo "some-long-and-secure-password" | gpg --armor --recipient someone@example.com --encrypt --output ~/.vault.gpg

Make sure it got encrypted correctly

@mld
mld / LICENSE
Last active August 19, 2021 21:09
Slackmail
Copyright (c) 2015 Kenneth Pedersen
Permission to use, copy, modify, and/or distribute this software for any purpose with or without fee is hereby granted, provided that the above copyright notice and this permission notice appear in all copies.
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
@mld
mld / k8s-compare
Created January 23, 2018 17:06
Compare kubernetes contexts (Dev/IAT/Prod/...)
#!/usr/bin/env bash
[[ "${DEBUG:-}" == 'true' ]] && set -o xtrace
set -o pipefail
set -o nounset
# Some nice to haves...
__dir="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
__file="${__dir}/$(basename "${BASH_SOURCE[0]}")"
__base="$(basename "${__file}" .sh)"
@mld
mld / start.c
Created September 5, 2017 10:56
zumo
/* This example uses the front proximity sensor on the Zumo 32U4
Front Sensor Array to locate an opponent robot or any other
reflective object. Using the motors to turn, it scans its
surroundings. If it senses an object, it turns on its yellow LED
and attempts to face towards that object. */
#include <Wire.h>
#include <Zumo32U4.h>
Zumo32U4LCD lcd;
@mld
mld / mysql-password.go
Created July 24, 2016 20:26
Go program for creating a mysql PASSWORD() hash
package main
// Used to encrypt passwords to mysql-standard
// ie. *+sha1(sha1(pw))
// http://dba.stackexchange.com/questions/22067/tool-to-match-mysql-password-encryption/22083#22083
import (
"crypto/sha1"
"flag"
"fmt"
)
@mld
mld / miscmath.sh
Created June 23, 2016 14:37
Prints sum, count, average, median, min and max values from a piped list of numbers. Modified by me, unknown origin.
#!/bin/sh
sort -n | awk '
BEGIN {
c = 0;
sum = 0;
}
$1 ~ /^[0-9]*(\.[0-9]*)?$/ {
a[c++] = $1;
sum += $1;
}
@mld
mld / monit-slack.php
Created April 25, 2016 11:01
Slack notification from monit
#!/usr/bin/php
<?php
// Change the url to a your own Slack custom post hook
$url = "https://hooks.slack.com/services/XXXXXXXXX/YYYYYYYYY/ZZZZZZZZZZZZZZZZZZZZZZZZ";
// Get monit environment variables
$monitdescription = getenv('MONIT_DESCRIPTION');
$monithost = getenv('MONIT_HOST');
//$monitservice = getenv('MONIT_SERVICE');

Keybase proof

I hereby claim:

  • I am mld on github.
  • I am mld (https://keybase.io/mld) on keybase.
  • I have a public key ASAvb3M-R9-_cteKlOc2Vh2gY4L9m_urPE76py6B1abU4go

To claim this, I am signing this object:

@mld
mld / HalonSR-v3.3p1-pkg_add
Created June 30, 2014 05:11
Missing modules when trying to run pkg_add in Halon Security Router
# pkg_add unbound
Can't locate strict.pm in @INC (@INC contains: /usr/local/libdata/perl5/site_perl/amd64-openbsd /usr/libdata/perl5/site_perl/amd64-openbsd /usr/local/libdata/perl5/site_perl /usr/libdata/perl5/site_perl /usr/libdata/perl5/amd64-openbsd/5.16.3 /usr/local/libdata/perl5/amd64-openbsd/5.16.3 /usr/libdata/perl5 /usr/local/libdata/perl5 .) at /usr/sbin/pkg_add line 19.
BEGIN failed--compilation aborted at /usr/sbin/pkg_add line 19.