Skip to content

Instantly share code, notes, and snippets.

View sahib's full-sized avatar
🤘

Chris Pahl sahib

🤘
View GitHub Profile
@sahib
sahib / mpdlisten.c
Created September 26, 2013 18:05
Compile: gcc mpdsonglisten.c -o mpdsonglisten -lmpdclient -std=c99 Run: ./mpdsonglisten localhost 6600 <on_play_script> <on_stop_script> Example: ./mpdsong localhost 6600 'echo plays!' 'echo stopped!' It will call on_play_script once mpd starts playing, and on_stop_script once it pauses, stops or does something unknown. Error handling is done by…
/*
* Compile: gcc mpdsonglisten.c -o mpdsonglisten -lmpdclient -std=c99
* Run: ./mpdsonglisten localhost 6600 <on_play_script> <on_stop_script>
* Example: ./mpdsong localhost 6600 'echo plays!' 'echo stopped!'
*
* It will call on_play_script once mpd starts playing,
* and on_stop_script once it pauses, stops or does something unknown.
*
* Error handling is done by ignoring none-fatal erros and trying to reconnect if
* fatal errors happen.
******************************************************************************
TMS320C2000 Linker PC v22.6.0
******************************************************************************
>> Linked Wed Jan 17 16:30:17 2024
OUTPUT FILE NAME: <../Core_2.out>
ENTRY POINT SYMBOL: "_c_int00" address: 00080e43
MEMORY CONFIGURATION
#!/bin/bash
# Description:
# Script to query mpd's status and download a cover of the currently playing
# song on song-change and execute a user-defined command to show the cover.
# (e.g. with notify-send, by default with a image viewer for testing)
# Feel free to make your customizations here.
MPD_SERVER="--port 6600 --host localhost" # For default case.
@sahib
sahib / clutter.py
Created May 4, 2013 19:56
Playing around with Python/Clutter/Gtk. Simple Swipe Effect.
from gi.repository import GLib, Gtk, GtkClutter, Clutter, Gdk, GdkPixbuf
import sys
from random import random
BROWSERS = 42
class ClutterBrowser(Gtk.ApplicationWindow):
@sahib
sahib / levenshtein_utf8.c
Created May 6, 2012 12:24
Better implementation to get the lv-distance of two utf8-strings
#include <glib.h>
#include <stdlib.h>
#include <string.h>
#include <stdio.h>
#include <locale.h>
///////////////////////////////
// Old version
gsize levenshtein_plain_strcmp(const gchar * s, const gchar * t)
@sahib
sahib / pipeline.py
Created December 17, 2012 13:58
Pipeline Example with Python Coroutines
'''
Python coroutine Example for a Pipeline model.
--------- ------- -------
| Source | => send() => | Pipe | => send() => | Sink |
--------- ------- -------
close() shutdown the *whole* Pipeline.
'''
$ GDK_SYNCHRONIZE="1" gdb --args python swipe.py
(gdb) r
(gdb) bt
#0 0x00007ffff5b3beed in g_logv () from /usr/lib/libglib-2.0.so.0
#1 0x00007ffff5b3c0d2 in g_log () from /usr/lib/libglib-2.0.so.0
#2 0x00007ffff2f46e60 in ?? () from /usr/lib/libgdk-3.so.0
#3 0x00007ffff2f51801 in ?? () from /usr/lib/libgdk-3.so.0
#4 0x00007ffff29fd976 in _XError () from /usr/lib/libX11.so.6
#5 0x00007ffff29fabc1 in ?? () from /usr/lib/libX11.so.6
#6 0x00007ffff29fac05 in ?? () from /usr/lib/libX11.so.6
@sahib
sahib / semaphor.c
Last active September 4, 2019 10:22
A rather primitive Semaphore implementation in C using pthreads
#include <pthread.h>
#include <stdio.h>
#include <stdlib.h>
/* Stupid implementation of C semaphores with pthreads.
* Used as mutex for counting a variable below.
*
* compile with:
*
* cc semaphor.c -o sam -lpthread -Wall -Wextra -std=c99 -Os
@sahib
sahib / Makefile
Last active July 5, 2019 07:05
cairo-pango-gles2 bug report (start reading surface.c -> main; the headers are from wayland weston and probably not relevant)
all:
gcc surface.c -o surface ${CFLAGS} ${LDFLAGS} $(shell pkg-config --libs --cflags cairo wayland-client wayland-server wayland-egl pango pangocairo) -lEGL -Wall -Wextra