Skip to content

Instantly share code, notes, and snippets.

View netsharec's full-sized avatar
🐧
Focusing

gle netsharec

🐧
Focusing
View GitHub Profile
@netsharec
netsharec / json.l
Created September 4, 2013 08:20 — forked from justjkk/LICENSE
%{
#include<stdio.h>
#include "y.tab.h"
char *strclone(char *str);
/*
#define STRING "str"
#define NUMBER "number"
#define O_BEGIN "o_begin"
#define O_END "o_end"
#define A_BEGIN "a_begin"
# This file is part of VISVIS. This file may be distributed
# seperately, but under the same license as VISVIS (LGPL).
#
# images2gif is free software: you can redistribute it and/or modify
# it under the terms of the GNU Lesser General Public License as
# published by the Free Software Foundation, either version 3 of
# the License, or (at your option) any later version.
#
# images2gif is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
@netsharec
netsharec / translate.go
Created December 30, 2015 15:22 — forked from hvoecking/translate.go
Golang reflection: traversing arbitrary structures
// Traverses an arbitrary struct and translates all stings it encounters
//
// I haven't seen an example for reflection traversing an arbitrary struct, so
// I want to share this with you. If you encounter any bugs or want to see
// another example please comment.
//
// The MIT License (MIT)
//
// Copyright (c) 2014 Heye Vöcking
//
@netsharec
netsharec / onchange.sh
Created January 5, 2016 14:31 — forked from senko/onchange.sh
Watch current directory and execute a command if anything in it changes
#!/bin/bash
#
# Watch current directory (recursively) for file changes, and execute
# a command when a file or directory is created, modified or deleted.
#
# Written by: Senko Rasic <senko.rasic@dobarkod.hr>
#
# Requires Linux, bash and inotifywait (from inotify-tools package).
#
# To avoid executing the command multiple times when a sequence of
@netsharec
netsharec / rfc3339.js
Created January 6, 2016 05:31 — forked from pjdietz/rfc3339.js
Format a local date as an RFC 3339 date with timezone
function rfc3339(d) {
function pad(n) {
return n < 10 ? "0" + n : n;
}
function timezoneOffset(offset) {
var sign;
if (offset === 0) {
return "Z";

Generated private key

openssl genrsa -out server.key 2048

To generate a certificate

openssl req -new -x509 -key server.key -out server.pem -days 3650

https

@netsharec
netsharec / preprocessor_fun.h
Created January 12, 2016 01:09 — forked from aras-p/preprocessor_fun.h
Things to commit just before leaving your job
// Just before switching jobs:
// Add one of these.
// Preferably into the same commit where you do a large merge.
//
// This started as a tweet with a joke of "C++ pro-tip: #define private public",
// and then it quickly escalated into more and more evil suggestions.
// I've tried to capture interesting suggestions here.
//
// Contributors: @r2d2rigo, @joeldevahl, @msinilo, @_Humus_,
// @YuriyODonnell, @rygorous, @cmuratori, @mike_acton, @grumpygiant,
@netsharec
netsharec / .Title
Created January 19, 2016 14:46 — forked from congjf/.Title
Using MongoDB in golang with mgo
Using MongoDB in golang with mgo
@netsharec
netsharec / alt.go
Created February 22, 2016 15:50 — forked from sanatgersappa/alt.go
Alternative handler for multiple file uploads in Go.
package main
import (
"html/template"
"io"
"net/http"
"os"
)
//Compile templates on start
@netsharec
netsharec / nginx.conf
Created March 5, 2016 07:16 — forked from micho/nginx.conf
nginx config for http/https proxy to localhost:3000
First, install nginx for mac with "brew install nginx".
Then follow homebrew's instructions to know where the config file is.
1. To use https you will need a self-signed certificate: https://devcenter.heroku.com/articles/ssl-certificate-self
2. Copy it somewhere (use full path in the example below for server.* files)
3. sudo nginx -s reload
4. Access https://localhost/
Edit /usr/local/etc/nginx/nginx.conf: