Skip to content

Instantly share code, notes, and snippets.

@ansell
ansell / install_postgresql9.4_postgis2.1_ubuntu.md
Last active February 26, 2019 09:17 — forked from hewerthomn/install_postgresql9.3_postgis2.1_ubuntu.md
Installing PostgreSQL 9.4 and PostGIS on Ubuntu 14.04

Remove old PostGIS Installation

The first step is to remove older version of PostGIS if any.

sudo apt-get purge postgis

Setup repository

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/ trusty-pgdg main" >> /etc/apt/sources.list.d/postgresql.list'
@ansell
ansell / gist:3f40f066b76a1df7ab849cc695bdfa91
Last active June 1, 2018 03:24 — forked from WintersMichael/gist:c70d195c5c5670d1625f
Shell one-liner to parse apache access logs and extract a unique URL list with hit count, querystring excluded.
cat access.log | awk -F\" '{print $2}' | awk '{print $2}' | sed '/^$/d' | sed 's/\?.*//g' | sort | uniq -c | sort -rn > url_hits.txt
cat access.log | awk -F\" '{print $2}' | awk '{print $2}' | sed '/^$/d' | sort | uniq -c | sort -rn > url_with_paths_hits.txt
cat access.log | awk -F\" '{print $2}' | awk '{print $2}' | sed '/^$/d' > raw_url_with_paths.txt
@ansell
ansell / use-sshuttle.sh
Last active March 3, 2018 00:26
sshuttle usage
#!/bin/bash
set -e
VIRTUAL_ENV_DIR="${HOME}/python-virtualenvironments/sshuttle"
GITREPOS_DIR="${VIRTUAL_ENV_DIR}/gitrepos"
SSHUTTLE_REPO="${GITREPOS_DIR}/sshuttle"
# Set these to match your server
TUNNEL_USER="${USER}"
@ansell
ansell / .bashrc
Created November 1, 2017 04:32
bash aliases
alias mci="mvn clean install"
alias mcist="mvn clean install -DskipTests"
alias mcd="mvn clean deploy"
alias mcd-sonatype="mvn clean deploy -Psonatype-oss-release"
alias gfa="git fetch --all"
alias gmff="git merge --ff-only"
### Keybase proof
I hereby claim:
* I am ansell on github.
* I am ansell (https://keybase.io/ansell) on keybase.
* I have a public key whose fingerprint is 9CFB AB43 0420 9E65 7781 6FBE 85D7 0B38 FE3F 41A1
To claim this, I am signing this object:
@ansell
ansell / fix-virtualbox.sh
Last active July 13, 2016 23:36
Mint-18 VirtualBox fix
#!/bin/sh
sudo apt-get purge virtualbox-guest-*
sudo apt-get install virtualbox-guest-*
sudo usermod -a -G vboxsf "${USER}"
# NOTE: Cannot use virtualbox guest utils as they add a requirement on Upstart when Ubuntu decided to follow the crowd and downgrade to systemd
@ansell
ansell / start_testing_java8_today.asciidoc
Created May 18, 2016 04:16 — forked from aslakknutsen/start_testing_java8_today.asciidoc
Example of how to use both JDK 7 and JDK 8 in one build.

JDK 8 Released

Most of us won’t be able to use/deploy JDK 8 in production for a looong time. But that shouldn’t stop us from using it, right?

It should be possible to sneak in JDK 8 in the back way, the same way we snuck in Groovy and other libraries we wanted to use.

The Test Suite to the rescue

The Maven compiler plugin run in two separate lifecycles, compile and testCompile. Those can be configured separately.

@ansell
ansell / install-haskell.sh
Last active May 17, 2016 00:14
Install haskell on ubuntu
#!/bin/sh
# Dependency of GHC
sudo apt-get install libbsd-dev libffi-dev libgmp3-dev libgmpxx4ldbl
cd ~/Downloads/
wget https://www.stackage.org/stack/linux-x86_64 -O stack.tar.gz
cd /opt/ && sudo tar -xzvf ~/Downloads/stack.tar.gz
sudo update-alternatives --install /usr/bin/stack stack /opt/stack-1.1.0-linux-x86_64/stack 1001
@ansell
ansell / SES-1803-TestResults.txt
Last active December 21, 2015 18:39
SES-1803 Test Results
Results :
Failed tests:
NativeCascadeValueExceptionTest>CascadeValueExceptionTest.testValueExceptionEqual:61 null
NativeSPARQLQueryTest>SPARQLQueryTest.runTest:221->SPARQLQueryTest.compareTupleQueryResults:380
============ open-eq-12 =======================
Unexpected bindings:
[v1="xyz"^^<http://www.w3.org/2001/XMLSchema#string>;y=http://example/x2;v2="xyz"@en;x=http://example/x1]
[v1="xyz"^^<http://www.w3.org/2001/XMLSchema#string>;y=http://example/x3;v2="xyz"@en;x=http://example/x1]
[v1="xyz"@en;y=http://example/x1;v2="xyz"^^<http://www.w3.org/2001/XMLSchema#string>;x=http://example/x2]
michaels-imac:stardog-1.2.1 mhgrove$ ./stardog-admin db drop -n testRulesDB
Successfully deleted database 'testRulesDB'.
michaels-imac:stardog-1.2.1 mhgrove$ ./stardog-admin db create -n testRulesDB
Successfully created database 'testRulesDB'.
michaels-imac:stardog-1.2.1 mhgrove$ ./stardog data add -u admin -p admin testRulesDB ~/Downloads/rules.ttl
Adding data from file: /Users/mhgrove/Downloads/rules.ttl
Added 42 RDF triples.