Skip to content

Instantly share code, notes, and snippets.

@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 / howto_gis_ubuntu.md
Last active March 27, 2020 09:57
Ubuntu-18.04/Mint-18 GIS hackery

Add ubuntugis PPA:

$ sudo add-apt-repository ppa:ubuntugis/ubuntugis-unstable
$ 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/ xenial-pgdg main" >> /etc/apt/sources.list.d/postgresql.list'

Add POSTGIS repository:

@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 / 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 / install-java.sh
Last active April 20, 2024 01:36
Ubuntu 18.04-Mint 18 installations for Java Maven Eclipse Kotlin Gradle
#!/bin/sh
# Install Java-8
#sudo add-apt-repository ppa:webupd8team/java -y
#sudo apt-get update
#echo oracle-java8-installer shared/accepted-oracle-license-v1-1 select true | sudo /usr/bin/debconf-set-selections
#echo oracle-java9-installer shared/accepted-oracle-license-v1-1 select true | sudo /usr/bin/debconf-set-selections
#sudo apt-get install oracle-java8-installer oracle-java9-installer oracle-java9-set-default
sudo apt-get install openjdk-8-jdk
# Purge the following packages
account-plugin-aim
account-plugin-facebook
account-plugin-flickr
account-plugin-jabber
account-plugin-salut
account-plugin-twitter
account-plugin-windows-live
account-plugin-yahoo
import org.apache.commons.math3.stat.regression.OLSMultipleLinearRegression;
public class LinearRegression {
public static void main(String[] args) {
double [] y = {-0.48812477, 0.33458213,
-0.52754476, -0.79863471,
-0.68544309, -0.12970239,
0.02355622, -0.31890850,
0.34725819, 0.08108851};
double [][] x = {{1,0}, {0,0},
{1,0}, {2,1},
@ansell
ansell / R-Installation
Last active August 29, 2015 14:08
Installing R
sudo apt-get install r-base r-base-dev r-doc-pdf r-mathlib autoconf2.13 r-cran-rcurl libcurl4-openssl-dev
Download RStudio from : http://www.rstudio.com/products/rstudio/
Inside RStudio run:
install.packages("devtools")
install.packages("ggplot2")
@ansell
ansell / CSVAggregator.java
Last active August 29, 2015 14:04
Aggregation of CSV rows using Java-8 functions
/**
* Finds a unique result in the given file, based on examining rows from the CSV and comparing
* them sequentially down the file using the given value aggregator function.
*
* @param <T>
* The type of the value that is being compared.
* @param <R>
* The type of the value that is being returned as the aggregation.
* @param nextFile
* The file to check