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 / rhythmdb_to_xspf.py
Created September 10, 2017 19:11
Script for converting a Rhythmbox database to a XSPF playlist
#!/usr/bin/env python3
import sys
import urllib.parse
import urllib.request
import xml.etree.ElementTree as ET
BASE_PATH = "file:///home/andreas/.audio_rhythmbox/"
if len(sys.argv) != 3:
@astoeckel
astoeckel / opusenc_example.c
Created November 15, 2017 07:06
libopusenc ope_continue_encoding_file
/*
Usage:
mkdir -p blocks
./opusenc_example test_libopusenc_ope_encoder_continue_new_file.raw
( for i in `find blocks -name '*.ogg' | sort -n`; do opusdec $i -; done ) | aplay -f dat
*/