Skip to content

Instantly share code, notes, and snippets.

View flymin's full-sized avatar
🐼
Working hard

Gao, Ruiyuan flymin

🐼
Working hard
View GitHub Profile

Keybase proof

I hereby claim:

  • I am flymin on github.
  • I am flymin (https://keybase.io/flymin) on keybase.
  • I have a public key ASCG-uIeSvPddW9QTSj7jTT9wxjzs4kn4OD2fMLiHEtPBgo

To claim this, I am signing this object:

@flymin
flymin / editpdf.py
Last active October 27, 2020 02:09
marge all pdf files and delete cover page in each file
from PyPDF2 import PdfFileWriter, PdfFileReader
import os
def merge_and_delete(files):
output = PdfFileWriter()
outpages = 0
for file in files:
path = os.path.join("book", file)
print(path)
input1 = PdfFileReader(open(path, 'rb'))
@flymin
flymin / F1 Check.py
Created February 27, 2020 05:02
[surface plot] draw a surface using matplotlib #python
from matplotlib import pyplot as plt
import numpy as np
from mpl_toolkits.mplot3d import Axes3D
fig = plt.figure()
ax = Axes3D(fig)
X = np.arange(0, 1, 0.05)
Y = np.arange(0, 1, 0.05)
X, Y = np.meshgrid(X, Y)
#F1
@flymin
flymin / algorithm footnote.tex
Last active February 13, 2020 04:14
[algo footnode] An example shows how to add footnote just below an algorithm. #Latex
\documentclass{article}
\usepackage[ruled]{algorithm2e}
\usepackage{amssymb,amsmath,caption}
\usepackage[hang,flushmargin]{footmisc}
\usepackage{lipsum}
\makeatletter
\newcommand{\algorithmfootnote}[2][\footnotesize]{%
\let\old@algocf@finish\@algocf@finish% Store algorithm finish macro
\def\@algocf@finish{\old@algocf@finish% Update finish macro to insert "footnote"
\leavevmode\rlap{\begin{minipage}{\linewidth}
@flymin
flymin / line.sh
Last active February 13, 2020 04:12
[LineCal] Calculate code line in a github repo #shell
#!/bin/bash
set -e
git clone --depth 1 "$1" temp-linecount-repo
printf "('temp-linecount-repo' will be deleted automatically)\n\n\n"
cloc temp-linecount-repo
rm -rf temp-linecount-repo
@flymin
flymin / diff.md
Last active February 13, 2020 04:16
[ModelArts] Model Migration for ModelArts #Other
@flymin
flymin / Scancode Map.reg
Last active February 13, 2020 04:13
[Cap<->Ctrl] switch left Ctrl with CapsLock on Windows
Windows Registry Editor Version 5.00
[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Keyboard Layout]
"Scancode Map"=hex:00,00,00,00,00,00,00,00,03,00,00,00,3a,00,1d,00,1d,00,3a,00,\
00,00,00,00
@flymin
flymin / tensorflow_rename_variables.py
Last active June 16, 2020 01:22 — forked from batzner/tensorflow_rename_variables.py
[ckpt rename] Small python script to rename variables in a TensorFlow checkpoint; add output option and only display changing variables #Tensorflow
import sys, getopt
import os
import pdb
import tensorflow as tf
usage_str = 'python tensorflow_rename_variables.py --checkpoint_dir=path/to/dir/ ' \
'--replace_from=substr --replace_to=substr --add_prefix=abc --dry_run ' \
'--output_dir=dir/to/output'