Skip to content

Instantly share code, notes, and snippets.

View archaeogeek's full-sized avatar
👋

Jo Cook archaeogeek

👋
View GitHub Profile
@archaeogeek
archaeogeek / install-docker.md
Created November 14, 2022 14:55 — forked from npearce/install-docker.md
Amazon Linux 2 - install docker & docker-compose using 'sudo amazon-linux-extras' command

UPDATE (March 2020, thanks @ic): I don't know the exact AMI version but yum install docker now works on the latest Amazon Linux 2. The instructions below may still be relevant depending on the vintage AMI you are using.

Amazon changed the install in Linux 2. One no-longer using 'yum' See: https://aws.amazon.com/amazon-linux-2/release-notes/

Docker CE Install

sudo amazon-linux-extras install docker
sudo service docker start
@archaeogeek
archaeogeek / gist:d7a3c20a12147bab38e1c0e75f56c1f1
Last active January 18, 2022 16:35
Prepping osopennames for ML
# extract zipped csv file to ~/osopennames
cd osopennames
# merge all csvs into one, with header first
for f in DATA/*.csv ; do cat $f; done > mergedwithoutheader.csv
# view top 5 or so lines to make sure it's what you expect
head -5 mergedwithoutheader.csv
# open in a text editor and remove any "
@archaeogeek
archaeogeek / gist:dd413568fbf7aabedc8ff101d6a4dc5b
Last active January 13, 2022 17:13
processing os open names with just linux cli tools
# extract zipped csv file to ~/osopennames
cd osopennames
# merge all csvs into one, with header first
for f in DATA/*.csv ; do cat DOC/OS_Open_Names_Header.csv $f; done > mergedwithheader.csv
# view top 5 or so lines to make sure it's what you expect
head -5 mergedwithheader.csv
# take only the columns we want
@archaeogeek
archaeogeek / pr.md
Created March 9, 2021 13:59 — forked from piscisaureus/pr.md
Checkout github pull requests locally

Locate the section for your github remote in the .git/config file. It looks like this:

[remote "origin"]
	fetch = +refs/heads/*:refs/remotes/origin/*
	url = git@github.com:joyent/node.git

Now add the line fetch = +refs/pull/*/head:refs/remotes/origin/pr/* to this section. Obviously, change the github url to match your project's URL. It ends up looking like this:

@archaeogeek
archaeogeek / csv2skosxl.php
Last active January 21, 2021 13:57
csv2skosxl modified
<?php
/**
* Sample script to convert an CSV (ie. exported form MS Excel file) into
* RDF skos format.
*
* @file csv2skos.php
* @license Licensed under WTFPL (http://www.wtfpl.net/txt/copying/)
* @author Cristian Romanescu <cristian.romanescu@eaudeweb.ro>
*/
@archaeogeek
archaeogeek / gist:a52b3ddc0fe068a19aa240e55d4ae7cf
Last active November 15, 2020 18:58
Github graphql examples
# search for my repos with the topic "talks"- note order doesn't work particularly well
query {
search(first: 20, type: REPOSITORY, query: "topic:talks user:archaeogeek sort:updated-desc") {
pageInfo {
hasNextPage
endCursor
}
repositories: edges {
repo: node {
@archaeogeek
archaeogeek / gist:7a8a0f6811ab9af98d511ac171a6531e
Created October 15, 2020 08:30
Python snippet for updating GeoNetwork using batch editing API
import requests
import click
from requests.auth import HTTPBasicAuth
from requests.packages.urllib3.exceptions import InsecureRequestWarning
import json
import pandas as pd
from collections import Counter
import os
import glob
import sys
@archaeogeek
archaeogeek / gist:788199ae56c0d3a04d6bb7b420c7c64b
Created April 23, 2020 16:49
Notes on setting up postgresql/postgis/elasticsearch/kibana in docker
# setup
sudo apt-get -y install apt-transport-https ca-certificates curl software-properties-common
wget -qO - https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -
sudo add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu bionic stable"
sudo apt update
sudo apt -y install docker-ce
sudo systemctl start docker
sudo systemctl enable docker
sudo usermod -aG docker $(whoami)
@archaeogeek
archaeogeek / gist:f9bd3ca8bff84bf0836fb35887d8a6e4
Last active April 1, 2020 15:08
Downgrade java to version 8 for Geonetwork
sudo update-alternatives --config java # check if java is already installed
sudo apt-get remove opendk* # purge any existing versions
sudo apt-get purge openjdk*
sudo apt-get update # refresh list
sudo apt-get install openjdk-8-jdk
java -version # check java version (should be openjdk version "1.8.0_222" or similar)
sudo update-alternatives --config java # switch to use jdk8 if necessary
sudo apt-get install tomcat8
sudo vi /etc/default/tomcat8 # edit to use following settings:
JAVA_OPTS="-Djava.awt.headless=true -Xmx1024m -XX:NewSize=256m -XX:MaxNewSize=256m -XX:PermSize=512m -XX:MaxPermSize=512m -XX:CompileCommand=exclude,net/sf/saxon/event/ReceivingContentHandler.startElement"
@archaeogeek
archaeogeek / gist:6a3732f88e12c48cfa5bf450c6173b63
Last active December 4, 2019 10:25
using geonetwork h2 database