Skip to content

Instantly share code, notes, and snippets.

@b4n
b4n / pm-dialog-mockup.glade
Created April 30, 2014 13:55
Geany PM dialog mockup (not like it's gonna happen like that, but we can have fun and maybe end up with something)
<?xml version="1.0" encoding="UTF-8"?>
<interface>
<requires lib="gtk+" version="2.24"/>
<!-- interface-naming-policy project-wide -->
<object class="GtkDialog" id="dialog1">
<property name="can_focus">False</property>
<property name="border_width">6</property>
<property name="title" translatable="yes">Plugin Manager</property>
<property name="icon_name">geany</property>
<property name="type_hint">dialog</property>
@b4n
b4n / Makefile
Last active August 29, 2015 13:59
PLUGIN := cc-plugin
PLUGIN_SOURCES := plugin.cc plugin.c
plugindir = $(HOME)/.config/geany/plugins
VPATH ?= .
# requires https://github.com/b4n/geany-plugin.mk
include $(VPATH)/geany-plugin.mk
@b4n
b4n / Makefile
Created April 12, 2014 01:21
Internal Mnemonics Checker -- Checks Geany's internal mnemonics for conflicts
PLUGIN := internal-mnemonics-check
VPATH ?= .
# requires https://github.com/b4n/geany-plugin.mk
include $(VPATH)/geany-plugin.mk
@b4n
b4n / Makefile.am
Last active August 29, 2015 13:57
No-libtool Autotools shared libraries: Welcome to Portability Hell
# alias libdir to prevent Automake from whining trying to be too smart
sodir = $(libdir)
so_PROGRAMS = libtt.so
bin_PROGRAMS = ttp
libtt_so_SOURCES = tt.c
libtt_so_CFLAGS = -fPIC
libtt_so_LDFLAGS = -shared
@b4n
b4n / main.c
Created December 29, 2013 20:28
Issue with GtkActionGroup inside GtkBuilder definitions
#include <gtk/gtk.h>
int
main (int argc,
char **argv)
{
GObject *object;
GtkBuilder *builder;
GError *err = NULL;
@b4n
b4n / ptimer.c
Last active December 15, 2015 21:18
Very simple timer using POSIX API
/*
* ptimer.c
* A timer using POSIX API
*
* Copyright (c) 2005-2008, Colomban Wendling <ban@herbesfolles.org>
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
* met:
@b4n
b4n / relative-project.py
Created October 2, 2012 14:12
Finding file after project move
import os
def path_inside(path, dir):
path = os.path.normpath(path)
dir = os.path.normpath(dir)
return os.path.commonprefix([path, dir]) == dir
def path_samepath(a, b):
return os.path.normpath(a) == os.path.normpath(b)
@b4n
b4n / threading.c
Created August 27, 2012 09:07
Threading with GTK
#include <gtk/gtk.h>
typedef struct
{
GtkWidget *window;
guint progress_id;
} WorkerData;
/* old, one loop
*
* With not enough data (< 4096):
* mem_read (..., 1, 4096): 162.099252s (100000000 runs)
* mem_read (..., 4096, 1): 0.967107s (100000000 runs)
* With enough data (>= 4096):
* mem_read (..., 1, 4096): 2274.210934 (100000000 runs)
* mem_read (..., 4096, 1): 10.416469 (100000000 runs)
*/