Skip to content

Instantly share code, notes, and snippets.

View holmesconan's full-sized avatar

Holmes Conan holmesconan

  • Hebei, China
View GitHub Profile
@holmesconan
holmesconan / vimrc
Last active August 12, 2022 03:50
Personal used vimrc
" This is a personal used vimrc, single file for basic settings
" indent
set autoindent
set smartindent
" TAB
set tabstop=2
set shiftwidth=2
set expandtab
@holmesconan
holmesconan / intel-hex.py
Created April 14, 2022 02:32
Intel HEX format display
import argparse
def parse_line(line: str) -> dict:
start_index = line.index(':')
record_line = line[start_index:]
record = {
'byte_count': int(record_line[1:3], 16),
'address': record_line[3:7],
'type': record_line[7:9],
@holmesconan
holmesconan / git-commit-template.md
Created January 13, 2022 01:50 — forked from lisawolderiksen/git-commit-template.md
Use a Git commit message template to write better commit messages

Using Git Commit Message Templates to Write Better Commit Messages

One of my colleagues shared an article on writing (good) Git commit messages today: How to Write a Git Commit Message. This excellent article explains why good Git commit messages are important, and explains what constitutes a good commit message. I wholeheartedly agree with what @cbeams writes in his article. (Have you read it yet? If not, go read it now. I'll wait.) It's sensible stuff. So I decided to start following the

@holmesconan
holmesconan / 1_install_build_deps.sh
Created March 9, 2021 09:15
Build AOSP for Raspberry Pi 4 Under WSL2/Ubuntu 20.04
#!/bin/sh
sudo apt install -y \
build-essential \
gcc-arm-linux-gnueabihf \
libssl-dev \
flex \
bison \
python-mako \
libncurses5 \
libncurses5-dev \
@holmesconan
holmesconan / .condarc
Created January 17, 2020 01:22
Anaconda 清华镜像配置
channels:
- defaults
show_channel_urls: true
default_channels:
- https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main
- https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free
- https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/r
custom_channels:
conda-forge: https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud
msys2: https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud
@holmesconan
holmesconan / cuda_10.0_installation_on_Ubuntu_18.04
Created January 1, 2020 16:11 — forked from Mahedi-61/cuda_11.8_installation_on_Ubuntu_22.04
CUDA 10.0 installation for Ubuntu 18.04 LTS
#!/bin/bash
## This gist contains step by step instructions to install cuda v10.0 and cudnn 7.5 in Ubuntu 18.04
### steps ####
# verify the system has a cuda-capable gpu
# download and install the nvidia cuda toolkit and cudnn
# setup environmental variables
# verify the installation
###
@holmesconan
holmesconan / docker-cleanup-resources.md
Created June 30, 2019 02:18 — forked from bastman/docker-cleanup-resources.md
docker cleanup guide: containers, images, volumes, networks

Docker - How to cleanup (unused) resources

Once in a while, you may need to cleanup resources (containers, volumes, images, networks) ...

delete volumes

// see: https://github.com/chadoe/docker-cleanup-volumes

$ docker volume rm $(docker volume ls -qf dangling=true)

$ docker volume ls -qf dangling=true | xargs -r docker volume rm

@holmesconan
holmesconan / pymysql.py
Created April 29, 2019 09:13
pymysql skeleton
import pymysql.cursors
def execute(cursor):
# Read a single record
sql = "SELECT `id`, `password` FROM `users` WHERE `email`=%s"
cursor.execute(sql, ('webmaster@python.org',))
result = cursor.fetchone()
print(result)
@holmesconan
holmesconan / choco-install.cmd
Created November 15, 2018 01:33
Chocolatey installer
@echo Install Chocolatey
@"%SystemRoot%\System32\WindowsPowerShell\v1.0\powershell.exe" -NoProfile -InputFormat None -ExecutionPolicy Bypass -Command "iex ((New-Object System.Net.WebClient).DownloadString('https://chocolatey.org/install.ps1'))" && SET "PATH=%PATH%;%ALLUSERSPROFILE%\chocolatey\bin"
@holmesconan
holmesconan / install_docker_ce.sh
Created September 20, 2018 11:01
Docker install script
#!/bin/sh
# 从阿里云的镜像安装 Docker CE
# 参考:https://help.aliyun.com/document_detail/60742.html
# step 1: 安装必要的一些系统工具
apt-get update
apt-get -y install apt-transport-https ca-certificates curl software-properties-common
# step 2: 安装GPG证书