Skip to content

Instantly share code, notes, and snippets.

overleaf/sharetex 使用中文
前面使用包时加上
\usepackage{CJKutf8} % 中文支持
% \begin{document} 下加上
\begin{CJK*}{UTF8}{gbsn}
centos7 use Developer Toolset 7
因在部署pytorch时, 需要gcc的版本至少为4.9, 而centos7的默认版本为4.8.5, 可用一下方式解决
# install scl
sudo yum install centos-release-scl
# install all devtoolsset
# sudo yum install devtoolset-7
@gglin001
gglin001 / setup.py
Created July 14, 2020 09:14 — forked from arthur-tacca/setup.py
setup.py for caffe
#!/usr/bin/env python
from setuptools import setup
setup(
name="caffe",
version='1.0rc3',
url='https://github.com/BVLC/caffe',
license='BSD',
description=('Caffe is a deep learning framework made with expression, '
@gglin001
gglin001 / final_code.py
Created November 24, 2020 11:00 — forked from anirudhshenoy/final_code.py
Code for the Blog at:
from torch import nn
from time import time
import torch
import numpy as np
import matplotlib.pyplot as plt
from tqdm import tqdm
from skimage.util.shape import view_as_windows
torch.manual_seed(42)
@gglin001
gglin001 / delete.md
Created April 17, 2021 05:49 — forked from timwco/delete.md
LinkedIn: Delete Messages (April 2020)

What

LinkedIn is a valuable resource, but sometimes it sucks. One of those times is when you want to delete messages. You have to select each message one by one. It takes about 4 "clicks" to successfully delete a message.

This script should help. Since LI requires you to perform multiple steps, I decided to automate it for you. Once you initiate the script, it will run every second. If a message has the ability to be deleted, it will be. If not, it will be archived. Some "InMail" messages cannot be deleted on the web app. This script should work as long as LI doesn't change their page layout or element names, which will happen eventually.

Last tested & verified working on: April, 07, 2021

Special Thanks to @lifedup for the updated script.

Effective Modern CMake

Getting Started

For a brief user-level introduction to CMake, watch C++ Weekly, Episode 78, Intro to CMake by Jason Turner. LLVM’s CMake Primer provides a good high-level introduction to the CMake syntax. Go read it now.

After that, watch Mathieu Ropert’s CppCon 2017 talk Using Modern CMake Patterns to Enforce a Good Modular Design (slides). It provides a thorough explanation of what modern CMake is and why it is so much better than “old school” CMake. The modular design ideas in this talk are based on the book [Large-Scale C++ Software Design](https://www.amazon.de/Large-Scale-Soft

@gglin001
gglin001 / cmake.py
Last active May 17, 2021 12:19
pytorch_edit_cmake.py
...
# old
def convert_cmake_value_to_python_value(cmake_value, cmake_type):
r"""Convert a CMake value in a string form to a Python value.
Args:
cmake_value (string): The CMake value in a string form (e.g., "ON", "OFF", "1").
cmake_type (string): The CMake type of :attr:`cmake_value`.
@gglin001
gglin001 / use_gold.sh
Created August 31, 2021 10:23 — forked from unhammer/use_gold.sh
Linking with lld on Ubuntu/Debian in CMake projects (or gold in automake projects)
sudo apt install binutils
cd ~/src/an_autotools_project
export CXXFLAGS='-fuse-ld=gold'
export CFLAGS='-fuse-ld=gold'
./configure
make -j4 # no longer wait for linking! =D
# gcc doesn't support -fuse-ld=lld http://gcc.gnu.org/ml/gcc-patches/2016-07/msg00145.html :(
@gglin001
gglin001 / unfollow-all.md
Created September 4, 2021 15:48 — forked from xeloader/unfollow-all.md
Unfollow everyone on LinkedIn

Unfollow everyone on Social Media

Unfollow everyone on LinkedIn

LinkedIn is even more clickbait than Facebook nowadays. Adios. 💣

Visit https://www.linkedin.com/feed/following/

Scroll down to load all of your contacts

Open developer console, run the following

@gglin001
gglin001 / fix_exfat_drive.md
Created September 19, 2021 04:52 — forked from scottopell/fix_exfat_drive.md
Fix corrupted exFAT disk macOS/OSX

exFAT support on macOS seems to have some bugs because my external drives with exFAT formatting will randomly get corrupted.

Disk Utility is unable to repair this at first, but the fix is this:

  1. Use diskutil list to find the right drive id.
  2. You want the id under the IDENTIFIER column, it should look like disk1s1
  3. Run sudo fsck_exfat -d <id from above>. eg sudo fsck_exfat -d disk1s3
  4. -d is debug so you'll see all your files output as they're processed.
  5. Answer YES if it gives you the prompt Main boot region needs to be updated. Yes/No?