This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#! /usr/bin/env python | |
# -*- coding: UTF-8 -*- | |
# | |
import sys | |
from PIL import Image | |
from PIL import ImageFile | |
ImageFile.MAXBLOCK = 1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#! /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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#! /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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
* 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: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#! /usr/bin/env python | |
# -*- coding: UTF-8 -*- | |
# | |
# This program is free software: you can redistribute it and/or modify | |
# it under the terms of the GNU General License as published by | |
# the Free Software Foundation, either version 3 of the License, or | |
# (at your option) any later version. | |
# | |
# This program is distributed in the hope that it will be useful, | |
# but WITHOUT ANY WARRANTY; without even the implied warranty of |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Inspired by: | |
# https://www.reddit.com/r/AskReddit/comments/ccbpzr/what_book_fucked_you_up_mentally/etmirvt/ | |
import code | |
class NS(dict): | |
def __setitem__(self, key, val): | |
if key in self and hasattr(self[key], 'assign'): | |
return self[key].assign.__get__(self[key])(val) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# docker build -t gcc-with-cpychecker . | |
FROM ubuntu:bionic | |
RUN apt-get update && apt-get install -y git g++-6 gcc-6-plugin-dev python3.7 libpython3.7 libpython3.7-dev python3-dev python3-six python3-pygments graphviz python3-lxml make | |
WORKDIR /usr/local/src | |
RUN git clone --branch v0.17 https://github.com/davidmalcolm/gcc-python-plugin.git gcc-python-plugin | |
WORKDIR /usr/local/src/gcc-python-plugin | |
RUN CC=gcc-6 CXX=g++-6 make PYTHON=python3 PYTHON_CONFIG=python3-config plugin |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# WARNING: | |
# This code is thread-unsafe. | |
# This code may break dicts if any key __hash__ are mutated as a side effect. | |
# Don't use in production or with threads unless you know what you're doing. | |
import types | |
import ctypes | |
import sys | |
from queue import Queue |
OlderNewer