Skip to content

Instantly share code, notes, and snippets.

View yuhangch's full-sized avatar
🚶
exhausted

陈昱行|Chen Yu-hang yuhangch

🚶
exhausted
View GitHub Profile

Oh my zsh.

Install with curl

sh -c "$(curl -fsSL https://raw.githubusercontent.com/robbyrussell/oh-my-zsh/master/tools/install.sh)"

In GFW , mannual get the code of install.sh and save to somewhere

chmod +x ./install.sh;./install.sh
@yuhangch
yuhangch / centos8-autojump.md
Last active August 16, 2020 03:07
CentOS 8 install autojump

Install autojump to CentOS 8.

Clone the repository to somewhere

git clone git://github.com/wting/autojump.git

link python3 to python

ln -s /usr/bin/python3 /usr/bin/python
@yuhangch
yuhangch / CentOS-Upgrade-Git.md
Last active March 5, 2020 02:35
centos 7 upgrade git

0)install dependencies

[root@qcloud ~]# yum install curl-devel expat-devel gettext-devel openssl-devel zlib-devel asciidoc
[root@qcloud ~]# yum install  gcc perl-ExtUtils-MakeMaker

1)uninstall builtin version(1.8.1)

@yuhangch
yuhangch / call.py
Created March 6, 2020 09:22
Python3 Call dll (c++) Function
import ctypes
from ctypes import *
string_raw = "char* args"
int_raw = 123
args1 = c_char_p(string_raw.encode('utf-8'))
args2 = c_int(int_raw)
lib = ctypes.cdll.LoadLibrary("D:\\path\\to\\func.dll")
@yuhangch
yuhangch / delete-repeat.sql
Created March 7, 2020 09:22
Delete Repeat Records in Postgresql
--将数据去重后存入临时表,PostgreSQL会自动创建tmp_table以及表结构
select distinct * into tmp_table from repeat_table;
--删除原记录
delete from repeat_table;
--将临时表数据插入原表
insert into repeat_table select * from tmp_table;
--删除临时表
drop table tmp_table;
import mercantile
import rasterio
from rasterio.session import OSSSession
from rasterio.warp import transform_bounds
from rio_tiler import constants
with rasterio.open(prefix) as src:
bounds = transform_bounds(
src.crs, constants.WGS84_CRS, *src.bounds, densify_pts=21
)
@yuhangch
yuhangch / img-to-redis.py
Created April 6, 2020 05:02
Save serialized pictures into redis
import pickle
import redis
class CACHE:
def __init__(self, host='127.0.0.1',password='123456'):
pool = redis.ConnectionPool(host=host, password=password)
self.conn = redis.Redis(connection_pool=pool)
def insert_image(self, frame_id, frame):
# 将图片序列化存入redis中
@yuhangch
yuhangch / setup-new-repo.md
Last active April 7, 2020 05:29
Config New Local Repository to Github by Cli

create a new repository on the command line

echo "# RepoName" >> README.md
git init
git add README.md
git commit -m "first commit"
git remote add origin git@github.com:username/RepoName.git
git push -u origin master
@yuhangch
yuhangch / id_seq.sql
Created June 1, 2020 12:58
Update Auto Increasing ID Next Value in PostgreSQL.
select setval('record_id_seq', (select max(id) from record));
@yuhangch
yuhangch / hugox
Last active April 13, 2024 05:07
Make Hugo New Post More Effective (OS X Only)
#!/bin/bash
# ./hugox test-ok-dd title-of-post catalog
cd ~/repos/blog
zh=$2
path=`hugo new posts/$1.md | cut -f1 -d" "`
echo $path
sed -i '' "s|\".*\"|\"${zh}\"|" $path
sed -i '' '5i\
tags: [""]
' $path