Skip to content

Instantly share code, notes, and snippets.

View inclyc's full-sized avatar

Yingchi Long inclyc

  • Institute of Computing Technology, CAS
  • Beijing
  • 03:32 (UTC +08:00)
View GitHub Profile
#!/bin/bash
# 遍历文件夹中的所有文件,将字符集从GB18030转换为UTF
# 参数:
# $1:源文件夹
# $2:目标文件夹
# 获取文件夹中的所有文件:
FILES=`find $1 -type f`
@inclyc
inclyc / render_ipynb.sh
Last active May 7, 2022 07:34
Render jupyter notebooks to pdf(via LaTeX)
#!/bin/bash
# 使用方法: 在有jupyter的环境下:
# ./render_jupyter.sh <文件名> <作者>
FILE_NAME=`echo ${1%.*} | awk -F/ '{print $NF}'`
TEX_FILE_NAME="$FILE_NAME.tex"
RENDER_DIR="./render/"
AUTHOR=$2
RENDER_DIR="$RENDER_DIR/$FILE_NAME/$AUTHOR/"
mkdir -p $RENDER_DIR
#!/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 \
# 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
@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}
@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 / 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 / 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 / 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"
{ lib
, stdenv
, glib
, fetchurl
, jdk
, xorg
, wayland
, libpulseaudio
, libglvnd
, libGL