Skip to content

Instantly share code, notes, and snippets.

Matthias Kadenbach mattes

Block or report user

Report or block mattes

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@victorcoder
victorcoder / haproxy.lua
Last active Feb 24, 2017
Heka haproxy lua decoder
View haproxy.lua
local dt = require "date_time"
local ip = require "ip_address"
local l = require 'lpeg'
local syslog = require "syslog"
l.locale(l)
local msg = {
Timestamp = nil,
Hostname = nil,
Payload = nil,
@chiedo
chiedo / boot2docker-nfs-osx.md
Last active Oct 4, 2019
Configuring boot2docker to use NFS on an OSX machine
View boot2docker-nfs-osx.md

Configuring Boot2Docker to use NFS on an OSX based machine

  • To improve the speed of Boot2Docker drastically, you will want to set it up to use NFS.
  • You will need to do the following once on your host machine:
    • Add this to /etc/exports on your mac

      # BOOT2-DOCKER-BEGIN
      /Users 192.168.59.103 -alldirs -mapall=501:20
      # BOOT2-DOCKER-END
      
@sailor
sailor / Vagrantfile
Created Mar 25, 2015
Vagrantfile for Rails development environment
View Vagrantfile
VAGRANTFILE_API_VERSION = '2'
$install = <<SCRIPT
curl -L https://github.com/docker/fig/releases/download/1.0.1/fig-`uname -s`-`uname -m` > /usr/local/bin/fig
chmod +x /usr/local/bin/fig
SCRIPT
$build = <<SCRIPT
cd /vagrant
fig build
@ngauthier
ngauthier / timeout_and_tick.go
Created Feb 10, 2015
Golang timeout and tick loop
View timeout_and_tick.go
// keepDoingSomething will keep trying to doSomething() until either
// we get a result from doSomething() or the timeout expires
func keepDoingSomething() (bool, error) {
timeout := time.After(5 * time.Second)
tick := time.Tick(500 * time.Millisecond)
// Keep trying until we're timed out or got a result or got an error
for {
select {
// Got a timeout! fail with a timeout error
case <-timeout:
@denji
denji / golang-tls.md
Last active Jan 28, 2020 — forked from spikebike/client.go
Simple Golang HTTPS/TLS Examples
View golang-tls.md

Moved to git repository: https://github.com/denji/golang-tls

Generate private key (.key)
# Key considerations for algorithm "RSA" ≥ 2048-bit
openssl genrsa -out server.key 2048

# Key considerations for algorithm "ECDSA" ≥ secp384r1
# List ECDSA the supported curves (openssl ecparam -list_curves)
@Jupiterrr
Jupiterrr / sync.sh
Last active Aug 29, 2015
This script syncs the current directory to /home/docker/share on a boot2docker vm.
View sync.sh
#!/bin/bash
set -u # prevent unbound variables
set -e # terminate on error
SSH_PORT=$(boot2docker config 2>&1 | awk '/SSHPort/ {print $3}')
# install rsync
boot2docker ssh tce-load -wi rsync
@schnoddelbotz
schnoddelbotz / call-x.pl
Last active Aug 29, 2015
Place a call from terminal using your iPhone - by providing contact's (partial) name (works for local/OnMyMac Contacts.app/AddressBook records only)
View call-x.pl
#!/usr/bin/perl
# call-x
# no beauty but some joy:
# use osx address book from terminal for (i)phone dialing purposes.
#
# usage:
# $ call-x your-pal's-name...or-partial-number...
#
# In response to the wonderful link max shared with me:
@jbardin
jbardin / proxy_copy.go
Last active Jan 13, 2019
Go TCP Proxy pattern
View proxy_copy.go
package proxy
import (
"io"
"log"
"net"
)
func Proxy(srvConn, cliConn *net.TCPConn) {
// channels to wait on the close event for each connection
@vkryukov
vkryukov / gist:4d53f84080bf088f087b
Created Jun 30, 2014
go.enmime library example
View gist:4d53f84080bf088f087b
package main
import (
"bytes"
"fmt"
"log"
"net/mail"
enmime "github.com/jhillyerd/go.enmime"
)
@Integralist
Integralist / Hash Keys to Symbols.rb
Last active Nov 7, 2019
Convert Ruby Hash keys into symbols
View Hash Keys to Symbols.rb
hash = { 'foo' => 'bar' }
# Version 1
hash = Hash[hash.map { |k, v| [k.to_sym, v] }]
# Version 2
hash = hash.reduce({}) do |memo, (k, v)|
memo.tap { |m| m[k.to_sym] = v }
end
You can’t perform that action at this time.