Skip to content

Instantly share code, notes, and snippets.

Cilyan /
Created Jan 7, 2021
Modification of sphinx.ext.ifconfig to run as a Transform as early as possible. By processing the conditions early and removing the nodes that will not go to the final doctree, the goal is to reduce the amount of unexpected errors and warnings that later transforms may face when processing nodes that are not going to be included anyway.
Provides the ``ifearly`` directive that allows to write documentation
that is included depending on configuration variables.
.. ifearly:: releaselevel in ('alpha', 'beta', 'rc')
Cilyan / 95-mkuki-install.hook
Created Dec 29, 2020
mkuki: Make Universal Kernel Image
View 95-mkuki-install.hook
Type = File
Operation = Install
Operation = Upgrade
Target = usr/lib/modules/*/vmlinuz
Target = usr/lib/initcpio/*
Target = boot/*.img
Target = boot/vmlinuz-*
Target = usr/lib/systemd/boot/efi/linuxx64.efi.stub
Target = usr/share/systemd/bootctl/splash-arch.bmp
Cilyan /
Last active Feb 29, 2020 — forked from wilbowma/
A perl script to create nginx chroot in arch linux.
# This script was hastily cobbled together for my own use. It can
# probably break your system. Use at your own risk.
$JAIL = "/srv/http";
$USER = "http";
$GROUP = "http";
$WWW_DIR = "www";
$BIN = "bin"; # "bin" or "sbin"
View main.cpp
#include <iostream>
#include "plugins.h"
int main()
auto &factory = PluginSystem::PluginFactory::Instance();
auto plugin = factory.GetPlugin("Plugin1");
Created Jan 20, 2016
PKGBUILD for libreoffice-extension-languagetool-nofr, a package that offers the LanguageTool LibO extension without french registered for compatibility with Grammalecte
# Maintainer: 3ED <krzysztof1987 /at/ gmail /dot/ com>
# Contributor: jtts
pkgdesc="An Open Source style and grammar checker. Will not register for french and can this be installed in parallel to Grammalecte"
Cilyan /
Created Aug 6, 2015
Simple utility to resolve dependencies between arbitrary (but hashable) objects.
#!/usr/bin/env python
# -*- coding: utf-8 -*-
class DependencyGraph(object):
Handle a dependency graph. Using :py:meth:`insert`, you add objects
to the graph and connect them with their dependencies, and the
:py:meth:`resolve` function will yield them back so that any object
comes after all its dependencies.
Cilyan /
Last active Aug 29, 2015
Example parser using a stateful lexer and a recursive descent parser. Goal is to parse a C file containing structures, unions and variables (no functions) and some doxygen comments, building an AST. (Originally part of a bigger project.)
# Nodes for the Abstract Syntax Tree
class Node(object):
def __init__(self):
self.children = []
self.parent = None
for attr in self.__attributes__:
setattr(self, attr, None)
def __repr__(self):
main_attr = self.__attributes__[0]
return "<{class_} {attr_name}={attr_value}".format(
Cilyan / robot.c
Created Mar 31, 2015
Strange nested construct of structures
View robot.c
#include <stdio.h>
#include <string.h>
/* gcc -Wall -Werror -std=c11 -pedantic -o robotc robot.c */
struct Robot_st {
int pos_x;
int pos_y;
struct BatteryStatus_st {
int capacity;
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import re
import timeit
# Public Domain
text = """
Many years ago, there was an Emperor, who was so excessively fond of
import timeit
import itertools
import operator
import random
import sys
import functools
import pprint
DEBUG = False