Skip to content

Instantly share code, notes, and snippets.

View harrymander's full-sized avatar

Harry Mander harrymander

View GitHub Profile
def extract_type_from_declaration(decl)
# Remove asterisks, type qualifiers, and struct specifiers etc. What is left
# should be 1 or 2 words. The first word is the 'base' type declaration. The
# second word, if present, is the argument name. Doesn't support function
# pointer types (which cannot be passed to macros anyway).
items = decl
.split(/([a-z_]\w*|\*+|\[.*?\])/i) # split at words, *, or [...]
.reject.with_index do |item, i| # remove whitespace
is_whitespace = i % 2 == 0
#!/bin/sh
set -e
# Start end groups to clone
START_GROUP=1
END_GROUP=134
# Comment out as appropriate to switch between SSH/HTTPS
GIT_PREFIX=git@eng-git.canterbury.ac.nz:ence361-2025
from scipy.fft import rfft, rfftfreq
import numpy as np
def dtft(x, w):
return np.sum(x * np.exp(-1j*w*np.arange(x.size)))
def sinusoid_freq(x, *, fs=1, niter=2, nfft=None):
"""
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@harrymander
harrymander / number-headings.gs
Last active August 17, 2023 02:11
Automatically number headings in Google Docs
/**
* Google Apps Script for automatically numbering headings in Google Docs.
*
* Adds a number to paragraphs with the "Heading [1-6]" styles. Paragraphs must
* start with '#' or their automatically-added number (regex:
* "^([0-9]+(?:[.][0-9]+)*[.] |#)") to be numbered.
*
* Headings 2-6 are numbered with the number of the previous next highest
* heading style, separated by a dot.
*

Keybase proof

I hereby claim:

  • I am harrymander on github.
  • I am harrymander (https://keybase.io/harrymander) on keybase.
  • I have a public key ASCaiUCWAX3FgaFet9b5O5wa5m7dRiHmVg4AnIyicjy1vQo

To claim this, I am signing this object: