Skip to content

Instantly share code, notes, and snippets.

# Sources:
# https://unix.stackexchange.com/a/408628
# https://github.com/InBetweenNames/gentooLTO/issues/149#issuecomment-425747633
# date +%s > /root/world_rebuild/stage0
set -e
starttime="$(cat /root/world_rebuild/stage0)"
eix '-I*' --format '<installedversions:DATESORT>' | cut -f1,3 > /root/world_rebuild/stage1
@zhuyifei1999
zhuyifei1999 / ensure_clone_stack_slign.S
Created October 28, 2018 20:09
LD_PRELOAD glibc wrapper to make sure stacks pointers given to clone(2) wrapper are 16-aligned.
/*
* Make sure stacks pointers given to clone(2) wrapper are 16-byte aligned.
*
* Public Domain / CC0
*
* i386 glibc clone.S has:
* andl $0xfffffff0, %ecx
* x86-64 has no such sort and you hit
* https://gcc.gnu.org/bugzilla/show_bug.cgi?id=40838
* and sadness somtimes happens :(. Compile this with:
@zhuyifei1999
zhuyifei1999 / build-root_fs.sh
Last active October 22, 2018 02:52
Build a Gentoo root_fs for QEMU/UML
#! /bin/bash
set -ex
TMPDIR=${TMPDIR:-/var/tmp}
IMAGE="$TMPDIR/root_fs"
STAGE3="$TMPDIR/stage3.tar"
ln -sf "$IMAGE" root_fs
# https://stackoverflow.com/a/49197786
#! /usr/bin/python
# -*- coding: UTF-8 -*-
#
# Tile merger
#
# Copyright (c) 2018 Zhuyifei1999
#
# 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
#! /usr/bin/env python
# -*- coding: UTF-8 -*-
#
import sys
from PIL import Image
from PIL import ImageFile
ImageFile.MAXBLOCK = 1
@zhuyifei1999
zhuyifei1999 / signbot.py
Last active April 15, 2022 14:53
Commons Signbot code
#!/usr/bin/python
# -*- coding: utf-8 -*-
#
# DUAL LICENSED: You are free to choose either or both of below licenses:
#
# 1.
#
# Published by zhuyifei1999 (https://wikitech.wikimedia.org/wiki/User:Zhuyifei1999)
# under the terms of Creative Commons Attribution-ShareAlike 3.0 Unported (CC BY-SA 3.0)
# https://creativecommons.org/licenses/by-sa/3.0/