Skip to content

Instantly share code, notes, and snippets.

View NickAnderegg's full-sized avatar

Nick Anderegg NickAnderegg

View GitHub Profile
@NickAnderegg
NickAnderegg / README.md
Last active June 14, 2021 19:21
git-clone-path: A script to help keep git repositories consistently named and located.

git-clone-path

This is a script that helps keep git repositories named and stored in a consistent way. When this script is run, it will clone the specified git repository to a standardized location with a standardized directory structure.

Running either of these commands will result in the same output:

git-clone-path git@github.com:cli/cli.git
git-clone-path https://github.com/cli/cli.git
@fauxneticien
fauxneticien / README.md
Last active June 23, 2023 06:22
Research knowledge base with Zotero, Highlights, and Obsidian

Research knowledge base with Zotero, Highlights, and Obsidian

Ever since I started working on my honours thesis in 2013, I had been tinkering with various workflows to manage references, PDFs, PDF annotations and notes all in some coherent way. The workflow I describe here is the latest one (February 2021 as of writing), and I think I've finally found something that satisfies a lot of the [admittedly very subjective] desiderata.

Knowledge provenance

Being [perhaps overly] wary of mis-citing something, I'd like to be able to quickly go back to the original source, and the exact page and PDF highlight that I'm referring to. For the last couple of years, I have been using the Highlights App (MacOS only, unfortunately; though there may be Windows/Linux equivalents). The two main features of Highlights are that:

  1. It automatically extracts PDF highlights and is able to keep them updated in a 'sidecar' file, so for a file like Ram_et_al_2020_Neural_Network.pdf, there'll be
@dale3h
dale3h / autocopy.sh
Created August 27, 2020 03:53
[unRAID] Auto-Copy for Unassigned Devices Plugin
#!/usr/bin/env bash
################################################################
# Auto-Copy Script for unRAID Unassigned Devices Plugin
# Original script: https://gitlab.com/snippets/1737763
################################################################
PATH=/usr/local/sbin:/usr/sbin:/sbin:/usr/local/bin:/usr/bin:/bin
# Available variables:
#
@benwattsjones
benwattsjones / gmail_mbox_parser.py
Last active April 23, 2024 18:31
Quick python code to parse mbox files, specifically those used by GMail. Extracts sender, date, plain text contents etc., ignores base64 attachments.
#! /usr/bin/env python3
# ~*~ utf-8 ~*~
import mailbox
import bs4
def get_html_text(html):
try:
return bs4.BeautifulSoup(html, 'lxml').body.get_text(' ', strip=True)
except AttributeError: # message contents empty
var gulp = require('gulp'),
path = require("path"),
gutil = require('gulp-util'),
uglify = require("gulp-uglify"),
ts = require("gulp-typescript"),
tsClientProject = ts.createProject("source/javascript/tsconfig.json"),
tsElectronProject = ts.createProject("source/app/tsconfig.json"),
bowersource = "bower_components/",
jshint = require('gulp-jshint'),
@veproza
veproza / AGPS.md
Last active July 23, 2023 04:36
Getting u-blox MAX-7C GPS to work with Assisted A-GPS

Getting u-blox MAX-7C GPS to work with Assisted A-GPS

So you got your u-blox GPS and wired it up only to look at it struggling to get a valid fix? Under less than ideal conditions, it can take a better part of half an hour. That's because unlike your smartphone GPS, it doesn't have the luxury of having downloaded all the auxiliary navigation data (almanacs and the lot) out-of-band, via fast mobile connection. Instead it relies on the satellite's signal itself, which is being transmitted to you at meager 50 bits per second (I'm not missing "kilo" there, it's three orders of magnitude slower than your 2G GPRS connection).

Luckily, the u-blox receivers are fitted with what the company calls "AssistNow" capability and it does exactly the same thing your iPhone does - feeds the GPS with pre-downloaded almanacs, speeding up the acquisition process to mere seconds.

In principle, the process looks easy enough - we just need to download the data, and then push them to the receiver. Sadly, the AssistNow documentat

@jctosta
jctosta / screen_cheatsheet.markdown
Last active April 25, 2024 14:39
Screen Cheatsheet

Screen Quick Reference

Basic

Description Command
Start a new session with session name screen -S <session_name>
List running sessions / screens screen -ls
Attach to a running session screen -x
Attach to a running session with name screen -r
@timpulver
timpulver / GetNameAndTitleOfActiveWindow.scpt
Created February 11, 2013 10:38
[AppleScript] Get Name of active window | Returns the name / title of the active (frontmost) window
# taken from user Albert's answer on StackOverflow
# http://stackoverflow.com/questions/5292204/macosx-get-foremost-window-title
# tested on Mac OS X 10.7.5
global frontApp, frontAppName, windowTitle
set windowTitle to ""
tell application "System Events"
set frontApp to first application process whose frontmost is true
set frontAppName to name of frontApp
@jedi4ever
jedi4ever / gist:1864622
Created February 19, 2012 16:55
parallels sdk send keycodes
import sys
import prlsdkapi
if len(sys.argv) != 4:
print "Usage: parallels_send_keycode '<VM_NAME>' '<keyname>' '<press|release>'"
exit()
# Parse arguments
vm_name=sys.argv[1]
# Keycode to use
@eqhmcow
eqhmcow / hfsc-shape.sh
Last active August 2, 2023 11:59
HFSC - linux traffic shaping's best kept secret
#!/bin/bash
# As the "bufferbloat" folks have recently re-discovered and/or more widely
# publicized, congestion avoidance algorithms (such as those found in TCP) do
# a great job of allowing network endpoints to negotiate transfer rates that
# maximize a link's bandwidth usage without unduly penalizing any particular
# stream. This allows bulk transfer streams to use the maximum available
# bandwidth without affecting the latency of non-bulk (e.g. interactive)
# streams.