Skip to content

Instantly share code, notes, and snippets.

@mattes
mattes / main.go
Last active August 29, 2015 14:16
package main
import (
"github.com/davecgh/go-spew/spew"
"reflect"
)
type Model struct {
Dirty bool
Error error
--no-rdoc --no-ri
@mattes
mattes / gist:8d7155a5d881751dc6ea
Created April 16, 2015 08:47
Check domain certificate
openssl s_client -connect example.com:443
##
# Host Database
#
# localhost is used to configure the loopback interface
# when the system is booting. Do not change this entry.
##
127.0.0.1 localhost
255.255.255.255 broadcasthost
::1 localhost
sudo route add -net 172.17 $(docker-machine ip $MACHINE_NAME)
# ephemeral port range
cat /proc/sys/net/ipv4/ip_local_port_range
# https://github.com/torvalds/linux/blob/master/include/net/tcp.h#L117
#define TCP_TIMEWAIT_LEN (60*HZ) /* how long to wait to destroy TIME-WAIT
* state, about 60 seconds */
@mattes
mattes / bootcmd
Created October 23, 2012 09:31
bootcmd for u-boot
fatload mmc 0 0x80300000 uImage
setenv bootargs console=ttyO2,115200n8 noinitrd init=/sbin/init root=/dev/mmcblk0p2 rootwait rw loglevel=8
bootm 80300000
@mattes
mattes / watch.c
Created October 31, 2012 13:54
watch directory for changes and print "update" on change
#include <sys/event.h>
#include <sys/time.h>
#include <fcntl.h>
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <iostream>
int main (int argc, const char *argv[])
{
@mattes
mattes / gist:3994595
Created November 1, 2012 16:05
Regular Expression for command line parameters
--command value
--command "another value"
/\s*("[^"]+"|[^\s"]+)/