Skip to content

Instantly share code, notes, and snippets.

View wjt's full-sized avatar
🚅
Travelling; I will be slow to respond until 17th November.

Will Thompson wjt

🚅
Travelling; I will be slow to respond until 17th November.
View GitHub Profile
def freeze(d):
return {k: frozenset(v) for k, v in d.items()}
def norm(word):
return ''.join(sorted(word))
class Mine:
@wjt
wjt / foo.c
Created October 22, 2018 12:34
#define _GNU_SOURCE
#include <string.h>
#include <glib.h>
static gchar *
get_product_from_image_version (const gchar *image_version)
{
gchar *hyphen_index = NULL;
if (image_version == NULL)
$ ipython3
Python 3.6.6 (default, Jul 19 2018, 14:25:17)
Type 'copyright', 'credits' or 'license' for more information
IPython 6.4.0 -- An enhanced Interactive Python. Type '?' for help.
In [1]: from gi.repository import Gio, GLib
In [2]: system_bus = Gio.bus_get_sync(Gio.BusType.SYSTEM)
In [3]: system_bus.call_sync('org.freedesktop.systemd1', '/org/freedesktop/systemd1', 'org.freedesktop.systemd1.Manager', 'Subscribe', None, None, Gio.DBusCallFlags.NONE, -1, None)
@wjt
wjt / Makefile
Last active October 4, 2018 10:36
replace_contents: replace_contents.c Makefile
$(CC) -std=gnu99 -o $@ $< -Wall -Werror `pkg-config --cflags --libs glib-2.0 gio-2.0`
#include <errno.h>
#include <glib.h>
int main (int argc, char **argv)
{
if (!g_utime (argv[1], NULL))
g_message ("g_utime succeeded");
else if (errno != ENOENT)
g_message ("failed: %s", g_strerror (errno));
else
@wjt
wjt / patch-3.diff
Last active September 27, 2018 15:22
--- /dev/fd/63 2018-09-27 16:21:18.511601957 +0100
+++ /dev/fd/62 2018-09-27 16:21:18.512601952 +0100
@@ -1,4 +1,4 @@
-commit 8b999ecc3637645bb66e3ba617b9e82af0b84167
+commit 53e27b29ee01346567ece5d1a55fc84d32bb28c7
Author: Will Thompson <[email protected]>
Date: Thu Sep 27 10:48:37 2018 +0100
@@ -14,10 +14,10 @@
https://phabricator.endlessm.com/T23877
commit eb8c2cf40a41569c4a8489733497476c2a388383
Author: Will Thompson <[email protected]>
Date: Thu Aug 2 22:26:37 2018 +0100
window: improve tile fraction calculation
diff --git a/src/core/window.c b/src/core/window.c
index e32366838..ac8253896 100644
--- a/src/core/window.c
+++ b/src/core/window.c

I hit this error:

The Meson build system
Version: 0.46.1
Source dir: /home/wjt/src/gnome/gnome-initial-setup
Build dir: /home/wjt/src/gnome/gnome-initial-setup/_build-meson
Build type: native build

meson_options.txt:12:0: ERROR:  Unknown type feature.
props.run_command(props.RUN_AT_BUILD_BEFORE_USER_PKGS,
'perl', '-ni', '-e',
'print; s{^deb }{deb-src }; print;',
'/etc/apt/sources.list')
props.run_command(props.RUN_AT_BUILD_BEFORE_USER_PKGS,
'apt', 'update', '-qqy')
props.run_command(props.RUN_AT_BUILD_BEFORE_USER_PKGS,
'apt', 'build-dep', '-qqy', 'grub2')
(function(exports) {
"use strict";
var ONE_KB = 1024;
var ONE_GB = ONE_KB * ONE_KB * ONE_KB;
function fetch(url) {
return new Promise(function(resolve, reject) {
var request = new XMLHttpRequest();
request.open("GET", url, true);