Skip to content

Instantly share code, notes, and snippets.

View vodik's full-sized avatar

Simon Gomizelj vodik

  • Movable Ink
  • Toronto, Ontario
View GitHub Profile
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <errno.h>
#include <fcntl.h>
int main(int argc, char *argv[])
{
int fd = open("/dev/spi_driver", O_RDONLY);
if (fd < 0)
@vodik
vodik / Makefile
Created November 16, 2011 05:40
Template for a WAVE reader.
CC = gcc
CFLAGS = -Wall -pedantic -std=gnu99 -g
LDFLAGS = -lasound
OBJ = wavereader.o alsa.o main.o
all: ademo
ademo: ${OBJ}
@echo CC -o $@
@vodik
vodik / alsa.c
Created November 19, 2011 06:21
/*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
module ItsNotWorking (
getLinks
) where
import Text.HTML.TagSoup
import Text.Regex.Posix
import Network.HTTP
isInteresting :: String -> Bool
isInteresting link = any (link =~) supported
@vodik
vodik / wanrec.sh
Created September 27, 2012 18:38 — forked from goodboy/wanrec.sh
script to record audio from sangoma cards
#!/bin/bash
# Tyler Goodlet tgoodlet@sangoma.com -- initial version
# Dependencies:
# -bash 4.0
# -gawk <ver?>
# TODO: add tcpdump tracing of SIP legs
# support bash 3.0 (i.e. remove coproc, associative arrays)
# script debug options - x for echo v for verbose: "set -<variable>" (to turn on), "set +<variable>" (to turn off)
@vodik
vodik / config.example.bash
Created September 28, 2012 01:12
My old firewall script
#! vim: ft=sh
EXTERNAL=eth0
INTERNAL=br0
NAT=static
EXTERNAL_IP='x.x.x.x'
NETWORK='10.0.0.0/22'
@vodik
vodik / gist:4013852
Created November 4, 2012 21:26
Upgrade path for archlinux-wiki
@vodik
vodik / bulkw.c
Last active December 15, 2015 17:49
Small utility to write to many files at once.
#define _GNU_SOURCE
#include <stdlib.h>
#include <stdio.h>
#include <errno.h>
#include <err.h>
#include <glob.h>
static int write_to(const char *msg, const char *path)
{
FILE *fp = fopen(path, "w");
@vodik
vodik / alpm-simple.c
Last active December 16, 2015 01:39
Load archlinux package metadata from a *.pkg.tar.* file.
#include "alpm-simple.h"
#include <stdlib.h>
#include <string.h>
#include <errno.h>
#include <err.h>
#include <fcntl.h>
#include <sys/stat.h>
#include <sys/mman.h>
@vodik
vodik / SOS.md
Last active May 8, 2024 18:21
_Never_ -Sy when installing!

Once upon a time there was a user that wanted to install firefox.

The user tried to do pacman -S firefox but it didn't work. The all mighty pacman reported that firefox-3.2.4-1.i686.pkg.tar.gz could not be found on his mirror. So the user tried pacman -Sy firefox. It worked and the user rejoiced since he could once again go and troll /h/.

But all was not good. The user had made a grave error!

See, when the user told the almighty pacman to -Sy firefox, pacman did