Skip to content

Instantly share code, notes, and snippets.

@b4n
b4n / lcs.c
Last active February 11, 2018 03:56
/*
* License: GPLv2+
* Author: Colomban Wendling <colomban@geany.org>
*/
/*
* FIXME: improve function names (e.g. strvstrv doesn't simply do strstr anymore)
*/
#include <stdlib.h>
@b4n
b4n / config-diff.sh
Created January 28, 2017 16:24
Script to diff configuration files (INI-style)
#!/bin/bash
# Diffs 2 configuration files, sorting their content by sections to and key
# names to get a meaningful diff.
sed_escape() {
sed 's/[][/\\.$^]/\\\0/g' <<<"$1"
}
read_section_sorted() {
@b4n
b4n / geany-run-helper.c
Created November 9, 2016 10:09
Attempt at a helper program wrapping a call, displaying the exit status and waiting on the user
/*
* geany-run-helper.c - this file is part of Geany, a fast and lightweight IDE
*
* Copyright 2016 Colomban Wendling <ban(at)herbesfolles(dot)org>
*
* 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 2 of the License, or
* (at your option) any later version.
*
@b4n
b4n / gen-gir.sh
Last active March 6, 2016 21:21
Generate Geany-1.0.gir from geany-gtkdoc.h with sciwrappers methods on the ScintillaObject itself
#!/bin/sh
set -e
trap 'rm -f /tmp/get-type.txt geany-gtkdoc-tmp.h' EXIT INT QUIT TERM
# prepare the get-type list
cat > /tmp/get-type.txt <<EOF
get-type:stash_group_get_type
get-type:tm_source_file_get_type
@b4n
b4n / mergetags
Last active August 29, 2015 14:24
mergetags -- A tool to update entries for a single file in a CTags tag file
#!/bin/sh
#
# FIXME: better error checking. As many commands are piped, their return code
# is not properly checked.
export LANG=C
set -e
### argument parsing
@b4n
b4n / Makefile
Last active August 29, 2015 14:21
Geany disabled C preprocessor highlighter
#!/usr/bin/make -f
PLUGIN = c-preproc-hl
VPATH ?= .
# fetch from https://github.com/b4n/geany-plugin.mk
include $(VPATH)/geany-plugin.mk
@b4n
b4n / Makefile
Last active August 29, 2015 14:20
Test Scintilla indicators in Geany
#!/usr/bin/make -f
PLUGIN = indictest
VPATH ?= .
# fetch from https://github.com/b4n/geany-plugin.mk
include $(VPATH)/geany-plugin.mk
@b4n
b4n / shadows.py
Created March 4, 2015 19:30
GTK shadow test
#!/usr/bin/env python
# chose either GTK 2 or 3
GTK=2
if GTK == 3:
from gi.repository import Gtk, GLib
else:
import gtk as Gtk
import glib as GLib
@b4n
b4n / tm_ws_thread.c
Last active August 29, 2015 14:08
A shot at the feasibility and implementation complexity of a thread-based asynchornous TM source file updating
/*
* Threaded TM updates.
*
* One worker thread processes parsing jobs.
*
* A job represents the update of one single source file.
* A group represents the user's update request, that can consist of several update jobs.
*
* The job<->group relation is many-to-many: A group can consist of multiple jobs, and a job can be
* shared by several groups. This allows to perform bulk updates as a single job, while allowing
@b4n
b4n / file.c
Created October 22, 2014 00:16
MIO file vs. mmap()ed file
#include <stdio.h>
#include "mio/mio.h"
int
main (int argc,
char **argv)
{
int ret = 0;
int i;