Skip to content

Instantly share code, notes, and snippets.

Avatar

Joel Nothman jnothman

  • Canva
  • Sydney
View GitHub Profile
@jnothman
jnothman / DataBricksNotebook2Ipynb.jq
Last active Sep 12, 2022
Approximately convert DataBricks notebook (unzipped .dbc file) to ipynb
View DataBricksNotebook2Ipynb.jq
.language as $lang |
{
"metadata" : {
"kernelspec": {
"display_name": "Python 3 (ipykernel)",
"language": "python",
"name": "python3"
},
"language_info": {
"codemirror_mode": {
View uspetplot-gh167.ipynb
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@jnothman
jnothman / userjs-qualtrics-newline.js
Created Apr 27, 2021
UserJS script to put newlines in qualtrics reports
View userjs-qualtrics-newline.js
// ==UserScript==
// @name Show newlines in Sydney U qualtrics reports
// @version 0.1
// @description try to take over the world!
// @author Joel Nothman
// @match https://sydney.au1.qualtrics.com/CP/Report.php?*
// @icon https://www.google.com/s2/favicons?domain=qualtrics.com
// @grant none
// ==/UserScript==
View git_cleaning_diffs.md

Title: Cleaning a git diff Date: 2020-07-02 Category: git Tags: git,shell,github,code review

Code review is easiest when the changes offered by a head branch onto a base branch are focussed on a single purpose of change. When they are not, the diff shown in GitHub can be long and hard to read, and the pull request is more susceptible to merge conflicts.

@jnothman
jnothman / populateSheetWithFolderListing.gs
Last active May 14, 2020
populateSheetWithFolderListing.gs
View populateSheetWithFolderListing.gs
/* Populate a Google Sheets worksheet with a file listing from Google Drive
Useful to enable filename -> URL lookup in Google Sheets
This can be scheduled in Google Apps Script with a specified Drive directory and Google Sheets spreadsheet.
Developed by the Sydney Informatics Hub, a Core Research of the University of Sydney.
Please acknowledge our support when using this tool in your research.
Authors: Vijay Raghunath, Joel Nothman.
View doit.sh
#!/bin/bash
pip install ghtopdep
export GITHUB_TOKEN=xxxxxxxxxxxxxxxx
export REPO=https://github.com/scikit-learn/scikit-learn
ghtopdep $REPO --json --rows 100 --minstar 5 --packages --token $GITHUB_TOKEN > top-packages.json
ghtopdep $REPO https://github.com/scikit-learn/scikit-learn --json --rows 100 --minstar 5 --repositories --token $GITHUB_TOKEN > top-repos.json
@jnothman
jnothman / fromisoformat.py
Created May 30, 2019
datetime.fromisoformat backported from Python 3.7
View fromisoformat.py
"""datetime.fromisoformat backported from Python 3.7
PYTHON SOFTWARE FOUNDATION LICENSE VERSION 2
--------------------------------------------
1. This LICENSE AGREEMENT is between the Python Software Foundation
("PSF"), and the Individual or Organization ("Licensee") accessing and
otherwise using this software ("Python") in source or binary form and
its associated documentation.
@jnothman
jnothman / paramfunc.py
Last active Jul 13, 2021
A wrapper for functions so that they can be parametrized with get_params and set_params in scikit-learn: proof of concept
View paramfunc.py
from collections import defaultdict
import pandas as pd
class parametrized_function:
def __init__(self, _func, **kwargs):
self._func = _func
self.__doc__ = self._func.__doc__
self.__name__ = self._func.__name__
# TODO use inspect to automatically find parameters with defaults
@jnothman
jnothman / script.js
Created Aug 28, 2018
Stoichiometry widget for LabArchives
View script.js
/* Stoichiometry Widget implemented by Joel Nothman at the Sydney Informatics Hub
Copyright (c) 2018, The University of Sydney
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
1. Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright
@jnothman
jnothman / docxtables.py
Created Aug 27, 2018
Load tables from Word docx to pandas dataframe
View docxtables.py
import zipfile
from lxml import etree
import pandas as pd
def read_docx(docx_file, **kwargs):
"""Read tables as DataFrames from a Word document
"""
ns = {'w': 'http://schemas.openxmlformats.org/wordprocessingml/2006/main'}
with zipfile.ZipFile(docx_file).open('word/document.xml') as f:
root = etree.parse(f)