Skip to content

Instantly share code, notes, and snippets.

View novelistparty's full-sized avatar

novelistparty novelistparty

View GitHub Profile
"""
Physics simulation with PyODE followed by a (basic) rendering with Vapory
See the result here: http://i.imgur.com/TdhxwGz.gifv
Zulko 2014
This script is placed in the Public Domain (Licence Creative Commons 0)
"""
@novelistparty
novelistparty / compute_modes.m
Last active August 29, 2015 14:20
Nested-function handles stored inside structures
function [modes] = compute_modes(Nmode,z,desc)
% COMPUTE_MODES example function to demonstrate nested-function handles
% John Boyle, April 2015
for jj = 1:Nmode
data(jj,:) = sin(2*pi*jj * z);
end
function plot_modes()
figure
for ii = 1:Nmode
@novelistparty
novelistparty / make_for_loops_for_richard.awk
Created October 12, 2015 18:14
The first awk file I made for someone else
#!/usr/bin/awk -f
# AWK can do cool things!
# x(58,strt:strt+7) = z(42:184:42+184*7);
# should map to:
# for (it = 0; it < 8; it++) x[58 + C * it] = z[42 + C * it];
BEGIN {
FS="[()]" # makes things within parentheses a field
}
@novelistparty
novelistparty / msequence_16_4taps.c
Last active May 15, 2016 19:31
m-sequence output as wav file from LFSR
#include <stdio.h>
#include <stdint.h>
#include <stdlib.h>
/*
Run with:
make msequence_16_4taps && ./msequence_16_4taps 4847 2 | sox -q -t .raw -r 44100 -c 1 -b 16 -e signed-integer - output.wav
Uses code from Wikipedia article "Pseudorandom binary sequence"
@novelistparty
novelistparty / dl.c
Last active January 12, 2017 06:18
a daily log program. Customize and compile.
/*
Created by John Boyle on 10 January 2017.
Updated 11 January 2017: use Markdown output, use ncurses.
*/
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <time.h>
#include <ncurses.h>
@novelistparty
novelistparty / git-pusheen
Last active March 8, 2017 18:21
git pusheen
#!/bin/bash
# Make it executable, put it in your path.
# call it with:
# $ git pusheen
#
# Image conversion by https://drewish.com/projects/unicoder/ by @drewish
# - John Boyle
set -euo pipefail
less -S <<HERE
@novelistparty
novelistparty / .vimrc
Last active June 29, 2018 21:59
small vimrc for quick setup
" Use Vim settings, rather than Vi settings (much better!).
" This must be first, because it changes other options as a side effect.
set nocompatible
" Make backspace behave in a sane manner.
set backspace=indent,eol,start
" Switch syntax highlighting on
syntax on
# skip the startup message
startup_message off
# go to home dir
chdir
# Automatically detach on hangup.
autodetach on
# Change default scrollback value for new windows
@novelistparty
novelistparty / simple_floatTOC_wnormalize.css
Last active July 10, 2018 20:19
pandoc template with fixed position toc and horizontal scrollable "pre" blocks
/*! normalize.css v8.0.0 | MIT License | github.com/necolas/normalize.css */
/* Document
========================================================================== */
/**
* 1. Correct the line height in all browsers.
* 2. Prevent adjustments of font size after orientation changes in iOS.
*/
@novelistparty
novelistparty / coroutine.c
Created August 19, 2020 17:44 — forked from rlcamp/coroutine.c
Coroutines for generator functions, sequential pipelines, state machines, and other uses in C
/*
Copyright 2015-2020 Richard Campbell
Permission to use, copy, modify, and/or distribute this software for any purpose with or without fee is hereby granted, provided that the above copyright notice and this permission notice appear in all copies.
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
Coroutines for generator functions, sequential pipelines, state machines, and other uses in C
Significant conceptual contribution by Rich Felker and others