Skip to content

Instantly share code, notes, and snippets.

View yuhangch's full-sized avatar
🚶
exhausted

陈昱行|Chen Yu-hang yuhangch

🚶
exhausted
View GitHub Profile
@yuhangch
yuhangch / do.md
Created August 13, 2020 08:06
rio-color windows

LIB

C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\SDK\ScopeCppSDK\VC\lib; C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\SDK\ScopeCppSDK\SDK\lib;

PATH

C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\SDK\ScopeCppSDK\SDK\include\ucrt; C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\SDK\ScopeCppSDK\VC\bin; C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\SDK\ScopeCppSDK\SDK\bin;

@yuhangch
yuhangch / bash.md
Last active August 10, 2020 06:41
Notes Collection
title date draft
Shell Notes
2019-10-16 16:41:23 +0800
true

source 的替代方法

. ~/.zshrc
@yuhangch
yuhangch / disable-auto-base.sh
Created July 30, 2020 12:48
Conda disable auto activate base
conda config --set auto_activate_base false
@yuhangch
yuhangch / deldot.sh
Created June 13, 2020 10:57
Mac Uninstall .Net Core
#!/usr/bin/env bash
#
# Copyright (c) .NET Foundation and contributors. All rights reserved.
# Licensed under the MIT license. See LICENSE file in the project root for full license information.
#
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
current_userid=$(id -u)
if [ $current_userid -ne 0 ]; then
@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
@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 / 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 [email protected]:username/RepoName.git
git push -u origin master
@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中
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 / 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;