Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

View astoeckel's full-sized avatar

Andreas Stöckel astoeckel

View GitHub Profile
@astoeckel
astoeckel / nmpm1_single_neuron.py
Last active October 13, 2015 22:29
Minimal Working Example of a single neuron and a single spike source on NMPM1
# -*- coding: utf-8 -*-
#
# Minimal Working Example of a single neuron and a single spike source on NMPM1
#
# Andreas Stöckel, October 2015
#
import pylogging
import pyhmf as pynn
@astoeckel
astoeckel / spikey_bug.py
Last active October 13, 2015 23:33
Spikey Bug: No spikes in for symmetric neuron populations
#!/usr/bin/env python
'''
Spikey Bug: Neuron Populations
'''
import pyNN.hardware.spikey as pynn
pynn.setup()
@astoeckel
astoeckel / sanity_check.sh
Created December 14, 2015 23:18
Search for evitable errors
#!/bin/bash
./clean.sh
FILES="`find chapters/ appendix/ frontmatter/ backmatter/ -name "*.tex" | sort` glossary.tex"
for FILE in $FILES; do
echo "============="
echo $FILE
echo "============="
@astoeckel
astoeckel / spikey_bug_inh_exc_tar.py
Last active March 25, 2016 22:45
Spikey Bug: Targeting excitatory and inhibitory synapses
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# Test script which demonstrates a Bug in Spikey:
# If a SpikeSourceArray targets both excitatory and inhibitory synapses (of
# different target neurons), only inhibitory connections are made.
import numpy as np
import pyNN.hardware.spikey as sim
@astoeckel
astoeckel / bitfields.cpp
Last active June 12, 2016 20:53
Using an array of bitfields in the bencharking code by Tony D in http://stackoverflow.com/questions/4240974/when-is-it-worthwhile-to-use-bit-fields
#include <time.h>
#include <stdlib.h>
#include <iostream>
#include <vector>
struct A
{
void a(unsigned n) { a_ = n; }
void b(unsigned n) { b_ = n; }
void c(unsigned n) { c_ = n; }
@astoeckel
astoeckel / copy_rating.py
Created July 2, 2016 14:54
Small script to copy the song ratings between Rhythmbox databases
#!/usr/bin/env python3
import xml.etree.ElementTree as ET
import sys
import unicodedata
import difflib
if len(sys.argv) != 4:
print("Usage: copy_rating <OLD DB> <NEW DB> <TARGET>")
sys.exit(1)
@astoeckel
astoeckel / expect_signal.cpp
Last active October 12, 2016 14:53
Google Test EXPECT_SIGNAL macro
#include <setjmp.h>
#include <signal.h>
#include <gtest/gtest.h>
static sigjmp_buf jmp_expect_signal;
static void handler(int) { siglongjmp(jmp_expect_signal, 1); }
#define EXPECT_SIGNAL(CODE, SIGNO) \
@astoeckel
astoeckel / leases_to_hosts.py
Last active February 8, 2017 23:20
Hackish dhcpd.leases to hosts converter (for mdns emulation with dnsmasq)
#!/usr/bin/env python3
import sys
if len(sys.argv) != 3:
print("Usage ./leases_to_hosts.py <DHCPD LEASES FILE> <OUTFILE>")
sys.exit(1)
def parse_string(f):
res = b''
@astoeckel
astoeckel / stream_local_audio.sh
Last active October 12, 2021 06:05
Stream audio from pulse audio as opus stream via UDP/RTP
#!/bin/sh
pacat \
--device=alsa_output.pci-0000_00_1b.0.analog-stereo.monitor \
--rate=48000 \
--record | \
opusenc \
--expect-loss=25 \
--max-delay=0 \
--framesize=2.5 \
@astoeckel
astoeckel / pdf_to_html_presentation.sh
Last active February 26, 2024 01:36
Script for the generation of an HTML presentation from a (LaTeX beamer) PDF
#!/bin/bash -e
# Fetch the number of pages in the pdf
NP=`pdfinfo "$1" | grep "Pages:" | sed 's/Pages:[ \t]*\(0-9\)*[ \t]*/\1/'`
# Fetch the title
TITLE=`pdfinfo "$1" | grep "Title:" | sed 's/Title:[ \t]*\(.*\)/\1/'`
# Create a target folder
NAME=`basename "$1" .pdf`