Skip to content

Instantly share code, notes, and snippets.

View JvGinkel's full-sized avatar

Jethro JvGinkel

  • Its Hosted
  • Netherlands
View GitHub Profile
@JvGinkel
JvGinkel / ruby ini to hash
Created March 20, 2018 17:46
Ruby convert ini file to a hash
def i2h_parse_line(line)
line.strip.split(';').first =~ %r{^\[([a-zA-Z0-9]+)\]$|^([a-zA-Z0-9\.]+)\s*\=\s*([a-zA-Z0-9\.]+)$}
data = [Regexp.last_match(1), Regexp.last_match(2), Regexp.last_match(3)]
data
end
def ini2hash(filename)
ini = {}
cur_section = nil
@JvGinkel
JvGinkel / r10kwebhook.php
Created April 1, 2018 18:44
Github webhook to trigger R10K runs on the puppet master
<?php
$config = yaml_parse_file('config.yaml');
$repo_full_name = $config['repo_full_name'];
$hookSecret = $config['hookSecret'];
set_error_handler(function($severity, $message, $file, $line) {
throw new \ErrorException($message, 0, $severity, $file, $line);
});
set_exception_handler(function($e) {
@JvGinkel
JvGinkel / main-webcam.py
Created August 1, 2018 11:46
face recognotion python script
# brew install cmake
# python3 -m venv face-recognition
# source face-recognition/bin/activate
# pip install dlib
# pip install face_recognition
# pip install opencv-python
import face_recognition
import cv2
import numpy as np
@JvGinkel
JvGinkel / gist:2bb3a760acca09c0091e6a266657928f
Created October 19, 2019 05:21 — forked from raphink/gist:bc4f43353c20417871cb
Puppet Proxy setup for the Puppet Server
<VirtualHost *:8140>
ServerName puppet-proxy
ServerAlias puppet-proxy.example.com
## SSL directives
SSLEngine on
SSLCertificateFile "/etc/puppet/ssl/certs/puppet-proxy.example.com.pem"
SSLCertificateKeyFile "/etc/puppet/ssl/private_keys/puppet-proxy.example.com.pem"
SSLCertificateChainFile "/etc/puppet/ssl/ca/ca_crt.pem"
SSLCACertificatePath "/etc/ssl/certs"
int channel; // channel value
const int ledPin = 0; // Output pin for rearlight LED
const int inputPin = 1; // Input signal from RC-receiver
int ledState = LOW; // Start with led off
unsigned long previousMillis = 0; // will store last time LED was updated
int interval = 0; // interval at which to blink default value
void setup() {
pinMode(inputPin, INPUT);
@JvGinkel
JvGinkel / openrc-gps-speedo.ino
Last active November 16, 2020 16:01
openrc-gps-speedo
// Load Wi-Fi library
#include <WiFi.h>
#include <SoftwareSerial.h>
#include <TinyGPS.h>
//#include "SD.h"
//#include <SPI.h>
// Define CS pin for the SD card module