Skip to content

Instantly share code, notes, and snippets.

/* $(CC) dft_example.c -lm -g -Wall */
#include <stdio.h>
#include <complex.h>
#include <math.h>
#define BUCKETS 16
/*
* XXX: looses any phase information.
* len samples go in and len freqs come out.
## put this at the bottom of your ~/.bashrc
##
[[ -n ${TMUX} ]] && return
[[ -n ${FALLBACK_SHELL} ]] && return
[[ ${TERM} != "linux" ]] && return
if [[ "$(tty)" = /dev/tty1 ]]; then
return
fi
exec ~/bin/bgterm -- tmux -u
@wobbol
wobbol / main.go
Last active February 8, 2019 18:09
Match filepaths like find (3)
package main
import (
"fmt"
"path/filepath"
"regexp"
"log"
)
// includeName checks if the name should be allowed or not based on the exclude patterns
func includeName(name string, patterns []string) (bool, error) {
@wobbol
wobbol / dirtest.c
Last active January 30, 2018 19:20
Why do I get warnings when I do this?
#include <stdarg.h>
#include <string.h>
#include <dirent.h>
#include <stdlib.h>
#include <stdio.h>
int min_example(const struct dirent *ent, char *string)
{
static const char *s = NULL;
if(string) {
@wobbol
wobbol / bench.c
Last active December 12, 2017 05:53
benchmark gcc and clang
#include <stdio.h>
#include <unistd.h>
#include <sys/wait.h>
#include <sys/times.h>
double run(char *arg[])
{
pid_t pid = fork();
if(pid == 0) {
execvp(arg[0], arg);
@wobbol
wobbol / main.cpp
Created October 25, 2017 21:23
Using std::shuffle with a dynamically allocated vector that holds a custom class.
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <random>
class widget {
private:
int feet;
int inches;