Skip to content

Instantly share code, notes, and snippets.

View iainlane's full-sized avatar
🔫
gg nextmap

Iain Lane iainlane

🔫
gg nextmap
View GitHub Profile
project ('test', 'c')
cc = meson.get_compiler ('c')
if (cc.has_argument ('-Wzzzzzzzz'))
error ('buggy')
else
error ('not buggy')
endif
@iainlane
iainlane / intercept_stderr.py
Created February 24, 2017 11:56
intercept_stderr
#!/usr/bin/python3
from splice import tee, splice
import asyncio.subprocess, errno, io, os, sys
# Run argv, return its stderr while also keeping it output to sys.stderr
def intercept_stderr(argv):
@asyncio.coroutine
def call_it(loop):
@iainlane
iainlane / gsize.c
Last active June 16, 2017 21:30
Doesn't work on Ubuntu/s390x, works on Ubuntu/amd64
/* gcc $(pkg-config --cflags glib-2.0) gsize.c $(pkg-config --libs glib-2.0) */
#include <glib.h>
#define FILENAME "/etc/passwd"
void main()
{
guint32 length;
g_autofree gchar* contents = NULL;
#include <errno.h>
#include <limits.h>
#include <sys/inotify.h>
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <time.h>
#include <unistd.h>
#define BUF_LEN (10 * (sizeof(struct inotify_event) + NAME_MAX + 1))
#!/bin/bash
# Run me like this:
# Download all the Packages files
# update-output-helper -u
# Create a worldview that britney is trying to mutate us to
# update-output-helper package/version package2/version2/ ...
# outputs an apt-get commandline to use
# Then call apt with this world view
# <apt-get command> update
#!/usr/bin/python3
import argparse
from collections import defaultdict
import datetime
import distro_info
import json
import urllib.request
import sys
#!/usr/bin/python3
from distro_info import UbuntuDistroInfo
from functools import total_ordering
@total_ordering
class UbuntuRelease(object):
all_releases = UbuntuDistroInfo().all
def __init__(self, release):
@iainlane
iainlane / shoulduninstall.py
Last active April 15, 2020 11:54
should we remove this?
#!/usr/bin/python3
import apt
import sys
def should_we_remove(pkg_name):
cache = apt.cache.Cache()
try:
@iainlane
iainlane / desktop.vala
Created May 1, 2020 13:11
am I in...?
using GLib;
private bool in_desktop (string desktop) {
var env = GLib.Environment.get_variable("XDG_CURRENT_DESKTOP");
if (env == null)
return false;
var desktop_parts = env.split(":");
#!/usr/bin/python3
from collections import defaultdict
import lzma
import os
import pprint
import yaml
NEW = "update_excuses_new.yaml.xz"
OLD = "update_excuses_old.yaml"