Skip to content

Instantly share code, notes, and snippets.

View dh1tw's full-sized avatar

Tobias Wellnitz dh1tw

View GitHub Profile
wget --quiet -O - https://www.postgresql.org/media/keys/ACCC4CF8.asc | sudo apt-key add -
sudo sh -c 'echo "deb http://apt.postgresql.org/pub/repos/apt/ precise-pgdg main" >> /etc/apt/sources.list.d/postgresql.list'
sudo apt-get update
sudo apt-get install postgresql-9.3 postgresql-server-dev-9.3 postgresql-contrib-9.3
sudo su -l postgres
psql -d template1 -p 5433
CREATE EXTENSION IF NOT EXISTS hstore;
CREATE EXTENSION IF NOT EXISTS "uuid-ossp";
service postgresql stop
@geografa
geografa / haversine_bearing.py
Created November 15, 2011 07:38
Haversine formula example in Python for calculating bearing
#!/usr/bin/env python
# Haversine formula example in Python for Calculating Bearing
# Inspired from http://www.movable-type.co.uk/scripts/latlong.html
import math
def bearing(origin, destination):
lat1, lon1 = origin
lat2, lon2 = destination
@markandrus
markandrus / server.js
Created July 9, 2014 01:01
WebRTC Test Client
// This is the signaling server for relaying messages between Node.js and
// Chrome. Run it with
//
// $ node server.js
//
function SignalingServer() {
var clients = {};
var WebSocketServer = require('ws').Server;
var wss = new WebSocketServer({
@livibetter
livibetter / README.rst
Last active January 22, 2021 08:39
Frequency spectrum of sound using PyAudio, NumPy, and Matplotlib
@qrkourier
qrkourier / ovirt-private-ca.md
Last active October 11, 2021 07:57
Install a Server Certificate For oVirt Manager UI

Install server certificates issued by a private CA in oVirt4 Manager and Host

  • generate a signing request on the system where oVirt Manager is running (the engine server)
openssl req -new -sha256 -key /etc/pki/ovirt-engine/keys/apache.key.nopass -out /tmp/engine.csr
  • Submit the CSR to the issuer and wait. Or, if you are the issuer and you happen to be using FreeIPA/IdM, you may issue the certificate with ipa-admintools. For example,
@fatih
fatih / ring.go
Created December 24, 2013 00:47
container/ring example golang
package main
import (
"container/ring"
"fmt"
"time"
)
func main() {
coffee := []string{"kenya", "guatemala", "ethiopia"}
@TheHippo
TheHippo / Makefile
Created March 31, 2016 22:32
Golang Makefile example
OUT := binariy-name
PKG := gitlab.com/group/project
VERSION := $(shell git describe --always --long --dirty)
PKG_LIST := $(shell go list ${PKG}/... | grep -v /vendor/)
GO_FILES := $(shell find . -name '*.go' | grep -v /vendor/)
all: run
server:
go build -i -v -o ${OUT} -ldflags="-X main.version=${VERSION}" ${PKG}
@johanndt
johanndt / upgrade-postgres-9.3-to-9.5.md
Last active July 15, 2022 12:35 — forked from dideler/upgrade-postgres-9.3-to-9.4.md
Upgrading PostgreSQL from 9.3 to 9.5 on Ubuntu

TL;DR

Install Postgres 9.5, and then:

sudo pg_dropcluster 9.5 main --stop
sudo pg_upgradecluster 9.3 main
sudo pg_dropcluster 9.3 main
@magnetikonline
magnetikonline / README.md
Last active July 28, 2022 07:25
Install Parallels version 10/11/12/13 tools on Ubuntu server guest.

Install OSX Parallels version 10/11/12/13 tools on Ubuntu server guest

Have tested these instructions successfully under Ubuntu 16.04LTS and 14.04LTS.

  • Create Ubuntu server instance under Parallels (obviously).
  • Start VM, goto Actions - Install Parallels Tools... to mount the ISO image.
    • Note: if this fails, or updating tools for an existing guest you can do the following:
    • Goto Devices > CD/DVD 1 > Connect Image....
    • Select the following ISO image: /Applications/Parallels Desktop/Contents/Resources/Tools/prl-tools-lin.iso.
    • This will mount the tools CD image.
@lowstz
lowstz / auto-ovpn.sh
Created February 8, 2012 15:22 — forked from xream/MacVPN.sh
Linux openvpn auto reconnect script
#!/bin/bash
export PATH=/usr/local/bin:/usr/bin:/bin:/usr/local/sbin:/usr/sbin:/sbin
### Thanks Xream's Work XD
# if you don't have several vpn servers to select, you can comment following line
# and use your openvpn config file name to replace "${host}.ovpn" in while loop.
read -p "Select the host: " host