Skip to content

Instantly share code, notes, and snippets.

View raphink's full-sized avatar
🐝
eBPF everything!

Raphaël Pinson raphink

🐝
eBPF everything!
View GitHub Profile
@raphink
raphink / yaml.go
Last active August 10, 2016 14:21
package main
import (
"fmt"
"io/ioutil"
"log"
"os"
"gopkg.in/yaml.v2"
)
type Fstab struct {
File string `augeas:"file"`
Vfstype string `augeas:"vfstype"`
Opt map[string]string `augeas:"opt" augeas-type:"array"`
Dump bool `augeas:"dump"`
Passno bool `augeas:"passno"`
} `augeas:"/files/etc/fstab" augeas-type:"seq"`
augeas { 'cacti_perms':
incl => '/etc/httpd/conf.d/cacti.conf',
lens => 'Httpd.lns',
changes => [
'defnode req Directory[arg="/usr/share/cacti/"]/IfModule[arg="mod_authz_core.c"]/directive[.="Require"] "Require"',
'set $req/arg[1] "all"',
'set $req/arg[2] "granted"',
'defnode nomodauthzcore Directory[arg="/usr/share/cacti/"]/IfModule[arg="!mod_authz_core.c"] ""',
'set $nomodauthzcore/directive[.="Allow"]/arg[2] "all"',
#!/bin/bash
FILE=$1
USER=$2
EMAIL=$3
realfile=$(readlink -f $FILE)
cat << EOF | augtool -Ast "Xml incl ${realfile}"
# Remove #empty node
@raphink
raphink / gist:317d6f0541d65f970edc45e9b5769443
Created April 22, 2016 11:35
highlightjs_prince_polyfill.js
// From https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/keys
if (!Object.keys) {
Object.keys = (function() {
'use strict';
var hasOwnProperty = Object.prototype.hasOwnProperty,
hasDontEnumBug = !({ toString: null }).propertyIsEnumerable('toString'),
dontEnums = [
'toString',
'toLocaleString',
'valueOf',
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@raphink
raphink / Dockerfile
Created April 8, 2016 11:28
Shipping a go binary with golang:onbuild
FROM golang:onbuild
@raphink
raphink / Dockerfile
Created April 8, 2016 11:09
Minimal docker image for go binary
FROM scratch
ADD app /
CMD ["/app"]

Les entrées

  • Assiette de charcuterie rie
  • Brownie de carotte au chevre
  • Caviar d'aubergine et gressin
  • Concassée de tomates épicées mousse de pesto
  • Creme d'asperges et oeuf poche
  • Crumble de concombre et creme au chevre
  • Dip de legumes sauce yaourt tapenade
  • Farfallina aux aubergines grillees et basilic
@raphink
raphink / ssh2pkcs1.rb
Last active March 31, 2016 10:23
SSH pub key to RSA Public Key (PKCS#1) with Ruby > 1.9.3, thanks to https://gist.github.com/emboss/2902696
require "base64"
require "openssl"
def unpacked_byte_array(ssh_type, encoded_key)
prefix = [7].pack("N") + ssh_type
decoded = Base64.decode64(encoded_key)
# Base64 decoding is too permissive, so we should validate if encoding is correct
unless Base64.encode64(decoded).gsub("\n", "") == encoded_key && decoded.slice!(0, prefix.length) == prefix
raise PublicKeyError, "validation error"