Skip to content

Instantly share code, notes, and snippets.

@swenzel
swenzel / wordGen.js
Created February 11, 2015 16:12
JavaScript random word generator
// DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
// Version 2, December 2004
//
// Copyright (C) 2015 Swen Wenzel <[email protected]>
//
// Everyone is permitted to copy and distribute verbatim or modified
// copies of this license document, and changing it is allowed as long
// as the name is changed.
//
// DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
@swenzel
swenzel / live_plot.py
Last active September 2, 2015 10:10
Live spike raster plot for PyNEST
# DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
# Version 2, December 2004
#
# Copyright (C) 2015 Swen Wenzel <[email protected]>
#
# Everyone is permitted to copy and distribute verbatim or modified
# copies of this license document, and changing it is allowed as long
# as the name is changed.
#
# DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
@swenzel
swenzel / pathutil.sh
Created January 11, 2017 12:07
Two utility functions for editing and viewing the PATH variable
pathed(){
tmpfile=$(mktemp)
IFS=':'
content=''
for p in $PATH; do
if [[ -z $content ]]; then
content="$p"
else
content="$content\n$p"
fi
@swenzel
swenzel / run
Last active April 26, 2023 12:49
Iteratively goes through parent directories to find and execute a script called "run.sh"
#!/usr/bin/env sh
# You can either copy paste the following function into your shell's rc file or
# you can just put this whole script as an executable file somewhere in your PATH for example at ~/.local/bin
run(){
local workdir
workdir="$(pwd)"
while [ ! -f "${workdir}/run.sh" ] && [ "${workdir}" != "/" ]; do
workdir="$(dirname "${workdir}")"
done