Skip to content

Instantly share code, notes, and snippets.

View masterzen's full-sized avatar

Brice Figureau masterzen

View GitHub Profile
@masterzen
masterzen / yubikey-setup.md
Last active February 7, 2024 17:02
Yubikey setup

Yubikey Setup

Preliminary steps

Install software

brew install gpg-suite
brew install yubico-piv-tool
brew install pinentry-mac
@masterzen
masterzen / keymap.c
Created September 23, 2018 14:12
QMK keymap to change rgb underglow based on Caps Lock
extern rgblight_config_t rgblight_config;
uint32_t mode;
uint16_t hue;
uint8_t sat;
uint8_t val;
void matrix_init_user(void)
{
-- Get the list of French posts translations
SELECT group_concat(p.id)
FROM wp_posts p
INNER JOIN wp_icl_translations tr ON tr.element_id=p.id
WHERE tr.element_type='post_post'
AND tr.language_code='fr'
GROUP BY element_type;
-- this produces this kind of output:
-- 9,13,14,22,24,34,35,42,47,52
# Windows AMIs don't have WinRM enabled by default -- this script will enable WinRM
# AND install 7-zip, curl and .NET 4 if its missing.
# Then use the EC2 tools to create a new AMI from the result, and you have a system
# that will execute user-data as a PowerShell script after the instance fires up!
# This has been tested on Windows 2008 SP2 64bits AMIs provided by Amazon
#
# Inject this as user-data of a Windows 2008 AMI, like this (edit the adminPassword to your needs):
#
# <powershell>
# Set-ExecutionPolicy Unrestricted
@masterzen
masterzen / jenkins-github-auth.groovy
Last active March 12, 2018 15:55
Allow to debug a user Github Authentication permission issues in Jenkins
import org.jenkinsci.plugins.GithubAuthenticationToken
import org.jenkinsci.plugins.GithubRequireOrganizationMembershipACL
import org.jenkinsci.plugins.GithubAuthorizationStrategy
import org.jenkinsci.plugins.GithubSecurityRealm
import org.jenkinsci.plugins.workflow.job.WorkflowJob;
import org.jenkinsci.plugins.workflow.multibranch.BranchJobProperty;
def token = hudson.util.Secret.fromString('{AQAAABAAAAAwvtwoemJy9LUqX59EEP5/qn+zg5H8WOHhH1GYHEm3uZNLndNWdgpf4h9SO6DtxALbliiYWno+AzcnasDhyIeIRg==}')
@masterzen
masterzen / mk-heartbeat-check.sh
Created January 13, 2012 14:50
Opennms General Poller for mk-heartbeat
#!/bin/sh
set -e
set -o pipefail
hostname=$2
RET=`/usr/bin/mk-heartbeat --database test --table heartbeat --user <user> --pass <pass> --host $hostname --check | sed -r -e 's, ,,g'`
RETVAL="$?"
if [ "$RETVAL" != "0" ]; then
exit $RETVAL
@masterzen
masterzen / connect.sh
Created November 15, 2010 07:12
Puppet SSL examples
# this simulates how a puppet agent will connect
openssl s_client -host puppet -port 8140 -cert /path/to/ssl/certs/node.domain.com.pem -key /path/to/ssl/private_keys/node.domain.com.pem -CAfile /path/to/ssl/certs/ca.pem
# outputs:
CONNECTED(00000004)
depth=1 /CN=Puppet CA: master.domain.com
verify return:1
depth=0 /CN=macbook.local
verify return:1
@masterzen
masterzen / prepare-commit-msg.sh
Created April 20, 2017 15:01
JIRA templated commit message
#!/bin/sh
set -e
# We don't want to mess with the commit message if no template has been
# defined, or if we're doing a special commit (rebase, merge, amend, ...)
[[ $2 != "template" ]] && exit 0
ticket_id=$(git symbolic-ref -q --short HEAD | perl -ne 'print if s,.*\b([a-z]+-[0-9]+).*$,\U\1,i');
if [ ! $ticket_id ]; then
# Couldn't get a matching ticket ID, so remove the template from the
# preformatted commit message.
template=$(git config --get commit.template)

Keybase proof

I hereby claim:

  • I am masterzen on github.
  • I am masterzen (https://keybase.io/masterzen) on keybase.
  • I have a public key ASBxnt-kj584WKDM2Vx34i54zI-i9aX2LF_TjKwa-uUPcQo

To claim this, I am signing this object:

% icinga2 console
[2016-04-21 16:16:30 +0200] information/icinga-app: Icinga application loader (version: r2.1.1-1)
[2016-04-21 16:16:30 +0200] information/icinga-app: Loading application type: icinga/IcingaApplication
[2016-04-21 16:16:30 +0200] information/Utility: Loading library 'libicinga.so'
[2016-04-21 16:16:30 +0200] information/ConfigCompiler: Adding include search dir: /usr/share/icinga2/include
[2016-04-21 16:16:30 +0200] critical/icinga-app: Another instance of Icinga already running with PID 19932