Skip to content

Instantly share code, notes, and snippets.

View nickynicolson's full-sized avatar

Nicky Nicolson nickynicolson

View GitHub Profile
@nickynicolson
nickynicolson / Open canvas content.md
Last active January 5, 2023 11:11
Open canvas in Obsidian for project planning

Problem

Top 1-3 problems that you want to solve

Solution

Outline proposed solution for each problem

Unique value proposition

@nickynicolson
nickynicolson / obsidian-web-clipper.js
Last active August 12, 2022 18:10 — forked from kepano/obsidian-web-clipper.js
Obsidian Web Clipper Bookmarklet to save articles and pages from the web (for Safari, Chrome, Firefox, and mobile browsers)
javascript: Promise.all([import('https://unpkg.com/turndown@6.0.0?module'), import('https://unpkg.com/@tehshrike/readability@0.2.0'), ]).then(async ([{
default: Turndown
}, {
default: Readability
}]) => {
/* Optional vault name */
const vault = "";
/* Optional folder name such as "Clippings/" */

Set up a dask gateway and print the dashboard URL

import dask_gateway

cluster = dask_gateway.GatewayCluster()
client = cluster.get_client()
cluster.scale(8)
print(cluster.dashboard_link)
@nickynicolson
nickynicolson / linking_obsidian_and_zotero.md
Last active May 16, 2022 14:54
Linking Obsidian and Zotero

Linking Obsidian and Zotero

Setup

Zotero

Zotero desktop used to manage literature references, with zotfile and zotero better bibtex plugins used to manage PDF attachments and create / maintain biblatex format downloads respectively.

Obsidian

Obsidian used to manage notes and tasks, with the citations plugin used to access literature references from the Zotero biblatex format export.

@nickynicolson
nickynicolson / history.md
Last active November 22, 2021 12:54
How to access & use command histories

bash

Default behaviour

  • history shows numbered command history, most recent last
  • !n retrieves command number n and executes it
  • !n:p retrieves command number n and places it into the command history without executing it. Up arrow then retrieves the command for editing

shopt

@nickynicolson
nickynicolson / reconciliation-api.ipynb
Created January 28, 2021 10:56
Direct coding against Open Refine reconciliation API
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@nickynicolson
nickynicolson / plot.py
Last active March 25, 2020 11:05
Display a networkx graph on a leaflet map
import networkx as nx
import numpy as np
import matplotlib as mpl
import matplotlib.pyplot as plt
import mplleaflet
import sys
def main():
inputfile=sys.argv[1]
outputfile_base=sys.argv[2]
@nickynicolson
nickynicolson / ih-download.py
Created March 24, 2020 15:26
Use the Index Herbariorum API to download data into a simple pandas dataframe
import pandas as pd
from pandas.io.json import json_normalize
import requests
# IH API documented here: https://github.com/nybgvh/IH-API/wiki
url='http://sweetgum.nybg.org/science/api/v1/institutions'
def main():
response = requests.get(url)
results = response.json()
# The JSON format record for an IH record has nested sections - the
@nickynicolson
nickynicolson / cm2df.py
Last active December 29, 2019 10:56 — forked from ClementC/print_cm.py
Convert scikit-learn confusion matrix to pandas DataFrame
from sklearn.metrics import confusion_matrix
import pandas as pd
def cm2df(cm, labels):
df = pd.DataFrame()
# rows
for i, row_label in enumerate(labels):
rowdata={}
# columns
for j, col_label in enumerate(labels):