Skip to content

Instantly share code, notes, and snippets.

View inclyc's full-sized avatar

Yingchi Long inclyc

  • Institute of Computing Technology, CAS
  • Beijing
  • 14:37 (UTC +08:00)
View GitHub Profile
@inclyc
inclyc / Group-Report.mk
Last active April 16, 2023 15:21
Generate report draft (markdown) and convert it into html (for email sending)
YEAR ?= $(shell date +"%Y")
MONTH ?= $(shell date +"%m")
DAY ?= $(shell date +"%d")
export YEAR
export MONTH
export DAY
PREFIX ?= $(YEAR)/$(MONTH)/$(DAY)
@inclyc
inclyc / filter.py
Created February 25, 2023 20:09
Rewrite labeled git commit message "pathlike", e.g "[foo][bar] baz" -> "foo/bar: baz"
#!/usr/bin/env python3
from sys import stdin
import re
def label2path(msg: str):
'''
"[foo][bar] baz" -> "foo/bar: baz"
For commit messages rewriting
{ lib
, stdenv
, glib
, fetchurl
, jdk
, xorg
, wayland
, libpulseaudio
, libglvnd
, libGL
@inclyc
inclyc / flake.lock
Created February 11, 2023 08:55
Nixpkgs lld_14 - libstdc++.so.6 reproduce flake
{
"nodes": {
"flake-utils": {
"locked": {
"lastModified": 1667395993,
"narHash": "sha256-nuEHfE/LcWyuSWnS8t12N1wc105Qtau+/OdUAjtQ0rA=",
"owner": "numtide",
"repo": "flake-utils",
"rev": "5aed5285a952e0b949eb3ba02c12fa4fcfef535f",
"type": "github"
@inclyc
inclyc / Makefile
Created February 8, 2023 15:51
Pure analysis test
test.asm: test
objdump -C -S $< > $@
test: main.o pure.o
clang -flto=thin -O2 $^ -o $@
%.o: %.c
clang -flto=thin -O2 $< -c -o $@
.PHONY: clean
@inclyc
inclyc / delete_branch.py
Created December 24, 2022 06:02
Delete a branch and its traking remote branch
#!/usr/bin/env python3
# Delete a branch and its traking remote branch
# Usage: ./delete_branch.py %{bname}
import sys
import subprocess
def callgitdelete(bname: str, remote: bool):
if remote:
@inclyc
inclyc / pick_branch.py
Last active December 12, 2022 07:07
This script cherry-pick all commits from branches (given in sys.args) to main.
#!/usr/bin/env python3
# Assume that you have branches locally for submitting patches, with only one commit ahead.
# E.g
# * 0bc8d76f8055092e59ecbb33357f8f0012903024 (jump-threading-58812) [JT] check xor operand is exactly the same in processBranchOnXOR
# | * 5a5c481943f7d76e2f7dd1e06d45a88f99b8f946 (vp-expand-nostdv) [RISCV][VP] expand vp instrinscs if no +v feature
# |/
# | * 65106e34c94723dbca44e1b6ebf8a1cc77744666 (vp-expand-redmul) [RISCV][VP] Support vp.reduce.mul by ExpandVectorPredication
# |/
@inclyc
inclyc / pick_branch.sh
Last active November 23, 2022 06:33
pick local branches to "main" branch
#!/usr/bin/env sh
set -e
MAIN_BRANCH=`git branch --show-current`
for pick_branch in "$@"; do
git checkout -b temp
git cherry-pick `git rev-parse ${pick_branch}`
git branch -M ${pick_branch}
# Preserve history
HISTFILE=~/.zsh_history
HISTSIZE=10000
SAVEHIST=10000
setopt inc_append_history share_history extended_history
# Documentation about opt: https://zsh.sourceforge.io/Doc/Release/Options.html
setopt correct
setopt autocd
setopt nomatch
#!/bin/bash
srv_ssl=${SRV_SSL:-'/srv/ssl'}
install_dir=${INSTALL_DIR:-"$srv_ssl/$cert_domain"}
certbot_home=${CERTBOT_HOME:-"$HOME/certbot"}
dns_dnspod_credentials=${DNS_DNSPOD_CREDENTIAL:-$HOME/secrets/dnspod/credentials.ini}
function request_cert {
cert_domain=${1:-'inclyc.cn'}
certbot certonly \