Skip to content

Instantly share code, notes, and snippets.

Avatar
👋

Jo Cook archaeogeek

👋
View GitHub Profile
View gist:d7a3c20a12147bab38e1c0e75f56c1f1
# 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 Jan 13, 2022
processing os open names with just linux cli tools
View gist:dd413568fbf7aabedc8ff101d6a4dc5b
# 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 Mar 9, 2021 — forked from piscisaureus/pr.md
Checkout github pull requests locally
View pr.md

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 Jan 21, 2021
csv2skosxl modified
View csv2skosxl.php
<?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>
*/
View gist:a52b3ddc0fe068a19aa240e55d4ae7cf
# 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 Oct 15, 2020
Python snippet for updating GeoNetwork using batch editing API
View gist:7a8a0f6811ab9af98d511ac171a6531e
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 Apr 23, 2020
Notes on setting up postgresql/postgis/elasticsearch/kibana in docker
View gist:788199ae56c0d3a04d6bb7b420c7c64b
# 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 Apr 1, 2020
Downgrade java to version 8 for Geonetwork
View gist:f9bd3ca8bff84bf0836fb35887d8a6e4
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"
View gist:6a3732f88e12c48cfa5bf450c6173b63
View gist:e226d4e071a2d4f6abc8fc9dc718eca7
net localgroup > C:\tmp\localgroups.txt
add multiple groups from a list (admin command prompt):
FOR /f %G IN (D:\Astun\gislocalgroups.txt) DO NET LOCALGROUP %G /COMMENT:"iShareGIS local group %G" /ADD
add user to all groups:
FOR /f %G IN (D:\Astun\gislocalgroups.txt) DO NET LOCALGROUP %G username /ADD