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
# Create swap file | |
sudo fallocate -l 1G /swapfile | |
sudo chmod 600 /swapfile | |
sudo mkswap /swapfile | |
sudo swapon /swapfile | |
echo '/swapfile none swap sw 0 0' >> /etc/fstab | |
sudo apt update | |
sudo apt dist-upgrade -y | |
sudo apt install -y docker.io |
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
/* | |
There is a behavior change in glibc>=2.30. dlopen() will fail if the file is | |
position independent executable. This code will clean up the PIE flag in the | |
file to bypass the dlopen() check. | |
MIT License (c) 2020 Yubo Xie, [email protected] | |
*/ | |
#include <stdio.h> | |
#include <string.h> |
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
# Preprocessor for mdbook to generate blockdiag. | |
# By [email protected], MIT License | |
# | |
# Convert the following code in .md to svg: | |
# | |
# ``` | |
# seqdiag { | |
# A --> B | |
# B --> C | |
# } |
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
import json; | |
import os; | |
import re; | |
import sys; | |
def processBookItem(src_path, item): | |
if 'Chapter' in item: | |
processChapter(src_path, item['Chapter']) | |
def processChapter(src_path, ch): |
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
# Delete all remote tags. | |
git tag -l | xargs -n 1 git push --delete origin | |
# Delete all remote branches except master. | |
git branch -r | grep -v master | sed 's/origin\///' | xargs -n 1 git push --delete origin | |
# Delete all merged branches. | |
git branch -r --merged | grep -v master | sed 's/origin\///' | xargs -n 1 git push --delete origin |