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
#!/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):
#!/usr/bin/python3
import argparse
from collections import defaultdict
import datetime
import distro_info
import json
import urllib.request
import sys
#!/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
#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))
@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;
@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):
project ('test', 'c')
cc = meson.get_compiler ('c')
if (cc.has_argument ('-Wzzzzzzzz'))
error ('buggy')
else
error ('not buggy')
endif