Skip to content

Instantly share code, notes, and snippets.

View ebassi's full-sized avatar

Emmanuele Bassi ebassi

View GitHub Profile
@ebassi
ebassi / git-ps1-bashrc.sh
Created May 9, 2012 10:38
enhancing __git_ps1 with a blacklist
# pretty hacky wrapper around __git_ps1 that checks directories in a blacklist
__git_maybe_ps1 ()
{
local fmt=''
if [ -z "${1-}" ]; then
fmt='(%s)'
else
fmt=${1}
fi
00:32 <@ebassi> desrt: since you're working on GtkApplication, it'd be nice to have your thoughts on bug 722856
00:32 < Services> Bug http://bugzilla.gnome.org/show_bug.cgi?id=722856 normal, Normal, ---, gtkdev, UNCONFIRMED, API to
communicate loading state
00:32 < desrt> ebassi: saw that.... not sure i agree that gtkapplication has a role here.
00:32 <@ebassi> desrt: also to make up some sort of startup notification protocol for wayland
00:33 <@ebassi> desrt: well, we're centralising the application story into one class, so I'd say the Application class would
be well suited for that; also because it's the application that knows if a window is effectively ready to be
shown
00:34 < desrt> ebassi: but it's not about the application -- it's about the window
00:34 <@ebassi> but a GtkApplicationWindow method would also be enough, I guess
/* gtkwidget.h */
gboolean gtk_widget_get_visible (GtkWidget *w);
/* gtkwidget-private.h */
struct _GtkWidgetPrivate
{
...
};
#ifdef GTK_COMPILATION
@ebassi
ebassi / getgrouplist
Created June 24, 2015 16:47
getgrouplist is a bad function, written by bad people
static gboolean
user_is_in_admin_group (uid_t user, const char *admin_group)
{
if (user == G_MAXUINT)
return FALSE;
if (admin_group == NULL || *admin_group == '\0')
admin_group = "wheel";
struct passwd *pw = getpwuid (user);
if (pw == NULL)
let context = widget.get_style_context();
let state = widget.get_state_flags();
context.save();
context.set_state(state);
padding = context.get_padding(context.get_state());
context.restore();
return padding;
@ebassi
ebassi / build-autofoo.sh
Last active January 27, 2017 15:58
Wrapper for non-srcdir builds with autotools
#!/bin/bash
# Copyright 2017 Emmanuele Bassi. All rights reserved.
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
{
"name": "tcl",
"no-autogen": true,
"cleanup-platform": ["*"],
"builddir": false,
"subdir": "unix",
"config-opts": [
"--disable-symbols"
],
"sources": [
@ebassi
ebassi / bashrc
Last active March 12, 2020 10:49
Fancy pants PS1
# .bashrc
# Source global definitions
if [ -f /etc/bashrc ]; then
. /etc/bashrc
fi
export EDITOR=vim
export PAGER=less
@ebassi
ebassi / fc-search-point.c
Created January 15, 2019 15:32
Find a UTF-8 glyph in your fonts
/* fc-search-point.c: Search for a UTF-8 code point in the installed fonts
*
* Requires: fontconfig
*
* Build with:
*
* ```sh
* $ cc \
* `pkg-config --cflags fontconfig` \
* -o fc-search-point fc-search-point.c \
/**
* login1_session_complete_take_device:
* @object: A #Login1Session.
* @invocation: (transfer full): A #GDBusMethodInvocation.
* @fd_list: (nullable): A #GUnixFDList or %NULL.
* @fd: Parameter to return.
* @paused: Parameter to return.
*
* Helper function used in service implementations to finish handling invocations of the <link linkend="gd
bus-method-org-freedesktop-login1-Session.TakeDevice">TakeDevice()</link> D-Bus method. If you instead wan