Skip to content

Instantly share code, notes, and snippets.

Avatar

Brice Figureau masterzen

View GitHub Profile
@masterzen
masterzen / keymap.c
Created Sep 23, 2018
QMK keymap to change rgb underglow based on Caps Lock
View keymap.c
extern rgblight_config_t rgblight_config;
uint32_t mode;
uint16_t hue;
uint8_t sat;
uint8_t val;
void matrix_init_user(void)
{
@masterzen
masterzen / jenkins-github-auth.groovy
Last active Mar 12, 2018
Allow to debug a user Github Authentication permission issues in Jenkins
View jenkins-github-auth.groovy
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 / prepare-commit-msg.sh
Created Apr 20, 2017
JIRA templated commit message
View prepare-commit-msg.sh
#!/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)
View keybase.md

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:

View gist:d33143e3c2ec581bec9b2fc328b4fbff
% 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
View ruby
###################
# #### RUBY STUFF
define eval
call(rb_p(rb_eval_string_protect($arg0,(int*)0)))
end
define redirect_stdout
call rb_eval_string("$_old_stdout, $stdout = $stdout, File.open('/tmp/ruby-debug.' + Process.pid.to_s, 'a'); $stdout.sync = true")
View Bootstrap-EC2-Windows-CloudInit.ps1
# 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 / MDC.java
Created Jan 12, 2013
10 commandments of logging - code extracts
View MDC.java
class UserRequest {
...
public void execute(int userid) {
MDC.put("user", userid);
... all logged message now will display the user=<userid> for this thread context ...
// user request processing is now finished, no need to log our current user
MDC.remote("user");
}
}
@masterzen
masterzen / threaddump-1
Created Mar 13, 2012
Jenkins 1.454 thread dump of a loooong Parsing POM operation on slave i-f57ee991
View threaddump-1
The slave that exhibits the issue is: i-f57ee991
Thread Dump
i-6f7aee0b
Channel reader thread: channel
"Channel reader thread: channel" Id=8 Group=main RUNNABLE (in native)
at java.io.FileInputStream.readBytes(Native Method)
@masterzen
masterzen / scan.rb
Created Feb 24, 2012
Parse Puppet AST for global node variables
View scan.rb
require 'puppet'
class Parser
def scan(input_file_name)
@input_file_name = input_file_name
environment = Puppet::Node::Environment.new
@known_resource_types = environment.known_resource_types
unless environment.known_resource_types.watching_file?(@input_file_name)
Puppet.info "rdoc: scanning #{@input_file_name}"
if @input_file_name =~ /\.pp$/
You can’t perform that action at this time.