Skip to content

Instantly share code, notes, and snippets.

@offlinehacker
offlinehacker / README.rst
Last active January 8, 2022 18:21
Script that learns openvpn hostnames from cert CN filed

ovpn-learnaddress

openvpn learn-address script to manage a hosts-like file

  • intended to allow dnsmasq to resolve openvpn clients
  • written for openwrt (busybox), but should work most anywhere

How it works?

@pauloconnor
pauloconnor / gist:4707710
Last active December 1, 2022 09:33
Logstash Mutate Filter for stripping Linux color codes from log files
# Get rid of color codes
mutate {
gsub => ["message", "\x1B\[([0-9]{1,2}(;[0-9]{1,2})?)?[m|K]", ""]
}
@scy
scy / opening-and-closing-an-ssh-tunnel-in-a-shell-script-the-smart-way.md
Last active March 15, 2024 11:26
Opening and closing an SSH tunnel in a shell script the smart way

Opening and closing an SSH tunnel in a shell script the smart way

I recently had the following problem:

  • From an unattended shell script (called by Jenkins), run a command-line tool that accesses the MySQL database on another host.
  • That tool doesn't know that the database is on another host, plus the MySQL port on that host is firewalled and not accessible from other machines.

We didn't want to open the MySQL port to the network, but it's possible to SSH from the Jenkins machine to the MySQL machine. So, basically you would do something like

ssh -L 3306:localhost:3306 remotehost

@TomByrne
TomByrne / MultiExporter.jsx
Last active March 19, 2024 10:12
An Illustrator script for exporting layers and/or artboards into separate files (PNG8 / PNG24 / EPS / PDF / SVG / JPG / FXG).See http://www.tbyrne.org/export-illustrator-layers-to-svg-files
// MultiExporter.jsx
// Version 0.1
// Version 0.2 Adds PNG and EPS exports
// Version 0.3 Adds support for exporting at different resolutions
// Version 0.4 Adds support for SVG, changed EPS behaviour to minimise output filesize
// Version 0.5 Fixed cropping issues
// Version 0.6 Added inner padding mode to prevent circular bounds clipping
//
// Copyright 2013 Tom Byrne
// Comments or suggestions to tom@tbyrne.org
@ehazlett
ehazlett / gist:9241844
Last active February 13, 2018 15:47
OpenShift Origin AWS

OpenShift Origin in AWS

This describes deploying and running OpenShift Origin in Amazon Web Services.

This is based upon the code and installer on 2014-02-26 so YMMV.

We will be using a VPC for deployment in us-east-1 and Route53 for DNS. I will leave the VPC setup as an exercise for the reader.

Prerequisites

  • AWS Account
  • VPC
@robertmarsal
robertmarsal / README.md
Last active March 20, 2022 02:26 — forked from mtowers/README.md
Google Analytics Real Time Visitors Widget for Dashing with OAuth2 Authentication
@soarez
soarez / ca.md
Last active April 22, 2024 03:01
How to setup your own CA with OpenSSL

How to setup your own CA with OpenSSL

For educational reasons I've decided to create my own CA. Here is what I learned.

First things first

Lets get some context first.

@Kartones
Kartones / postgres-cheatsheet.md
Last active April 30, 2024 19:47
PostgreSQL command line cheatsheet

PSQL

Magic words:

psql -U postgres

Some interesting flags (to see all, use -h or --help depending on your psql version):

  • -E: will describe the underlaying queries of the \ commands (cool for learning!)
  • -l: psql will list all databases and then exit (useful if the user you connect with doesn't has a default database, like at AWS RDS)
import Darwin
extension Array {
func shuffle() -> Array {
// this will sometimes crash (submitted bug #17127524)
self.sort { _,_ in arc4random_uniform(2) == 1 }
return self
}
mutating func removeAtIndexes( indexes:Int... ) {
indexes.sort(>)
@booherbg
booherbg / gist:f812c9145d157d8945b2
Last active February 25, 2022 23:44
Cross compiling a simple go server for windows

How to build Golang windows/arm static binaries from linux

Alternate title: Cross compiling Windows/Darwin/Linux amd64/386/arm all from linux

After fumbling around trying to figure out the go toolchain and cross compilation configuration, I ran across the wiki page on Go's homepage. It's super helpful, and worked out of the box. I'm including the necessary scripts here in case they get changed or lost, and we can help Google find it (since it's the first real source I've found that "Just Worked"). http://code.google.com/p/go-wiki/wiki/WindowsCrossCompiling