Skip to content

Instantly share code, notes, and snippets.

View Tantas's full-sized avatar

Joseph Preiss Tantas

  • Toronto Area, Ontario, Canada
View GitHub Profile
@Tantas
Tantas / log.go
Last active September 8, 2021 18:22 — forked from cespare/log.go
Apache access logs for golang.
import (
"fmt"
"io"
"net/http"
"strings"
"time"
)
// https://httpd.apache.org/docs/2.2/logs.html#combined + execution time.
const apacheFormatPattern = "%s - - [%s] \"%s %s %s\" %d %d \"%s\" \"%s\" %.4f\n"
@Tantas
Tantas / vpnsetup.sh
Last active March 25, 2023 16:13 — forked from hwdsl2/.MOVED.md
Ubuntu 14.04 LTS L2TP/IPSec VPN Behind NAT
#!/bin/sh
#
# Amazon EC2 user-data file for automatic configuration of IPsec/L2TP VPN
# on a Ubuntu server instance. Tested with 14.04 (Trusty) AND 12.04 (Precise).
# With minor modifications, this script *can also be used* on dedicated servers
# or any KVM- or XEN-based Virtual Private Server (VPS) from other providers.
#
# DO NOT RUN THIS SCRIPT ON YOUR PC OR MAC! THIS IS MEANT TO BE RUN WHEN
# YOUR AMAZON EC2 INSTANCE STARTS!
#
@Tantas
Tantas / gist:5412d1e319c69d0d56ab
Last active August 29, 2015 14:04 — forked from cdown/gist:1163649
Pure Bash Implementation of URL Decode
stripEncodedLineEndings() {
# stripEncodedLineEndings <string>
local stripFirstPart="${1//%0D}"
echo "${stripFirstPart//%0A}"
}
urlencode() {
# urlencode <string>