Skip to content

Instantly share code, notes, and snippets.

Avatar
:octocat:
Wubba lubba dub dub

Roger RRRoger

:octocat:
Wubba lubba dub dub
View GitHub Profile
@RRRoger
RRRoger / 协程线程进程.md
Created December 13, 2021 09:37
协程 线程 进程
View 协程线程进程.md

1.我们只需要 CPU 运行我们自己写的代码,尽可能少的运行别的代码。

2.协程或纤程 = 我们写的代码 + 尽可能少的程序框架的管理代码

3.线程 = 协程或纤程 + 操作系统的一小部分管理代码

4.进程 = 线程 + 操作系统的一大部分管理代码

如果这样说,你还不明白,再举个例子:

@RRRoger
RRRoger / mac同步时间服务器.sh
Created November 14, 2021 02:22
mac同步时间服务器
View mac同步时间服务器.sh
sudo sntp -sS time.apple.com
@RRRoger
RRRoger / 三体广播剧.sh
Last active November 14, 2021 02:24
三体广播剧.sh
View 三体广播剧.sh
# 三体广播剧第五季
# pip install youtube-dl
# 开代理
youtube-dl -x --audio-format mp3 https://www.youtube.com/watch?v=NlqiUhSvONI
youtube-dl -x --audio-format mp3 https://www.youtube.com/watch?v=UOaBSVZjkAo
youtube-dl -x --audio-format mp3 https://www.youtube.com/watch?v=d9YvPU9-O7o
youtube-dl -x --audio-format mp3 https://www.youtube.com/watch?v=z_M0nhLfbis
youtube-dl -x --audio-format mp3 https://www.youtube.com/watch?v=GejPJjA3CGs
youtube-dl -x --audio-format mp3 https://www.youtube.com/watch?v=StUBmm-giJU
@RRRoger
RRRoger / upsert_do_nothing.py
Last active November 14, 2021 02:25
Upsert Do Nothing
View upsert_do_nothing.py
INSERT INTO customers (NAME, email)
VALUES('Microsoft','hotline@microsoft.com')
ON CONFLICT ON CONSTRAINT customers_name_key
DO NOTHING;
@RRRoger
RRRoger / 重复记录过滤.sql
Last active March 11, 2022 13:55
重复记录过滤.sql
View 重复记录过滤.sql
with main_table as (
...
)
SELECT
a.*
FROM
main_table as a
@RRRoger
RRRoger / restart_server.sh
Created June 25, 2021 11:04
Flask Server Bash
View restart_server.sh
Port=5000 # Or 5000
pypath="$PWD/miniconda3/envs/py36/bin"
pid=`ps ax | grep gunicorn | grep $Port | awk '{split($0,a," "); print a[1]}' | head -n 1`
if [ -z "$pid" ]; then
echo "No gunicorn deamon on port $Port"
else
kill $pid
echo "Killed gunicorn deamon on port $Port"
fi
@RRRoger
RRRoger / AES_v2.py
Created May 27, 2021 03:38
加密测试 AES_v2.py
View AES_v2.py
#coding: utf8
import sys
from Crypto.Cipher import AES
from binascii import b2a_hex, a2b_hex
class prpcrypt():
def __init__(self, key):
self.key = key
self.mode = AES.MODE_CBC
@RRRoger
RRRoger / CNlink.py
Last active November 14, 2021 02:24
成语接龙
View CNlink.py
View psql_error.md

Error

dyld: Library not loaded: /usr/local/opt/readline/lib/libreadline.7.dylib
  Referenced from: /usr/local/bin/psql
  Reason: image not found
[1]    32507 abort      psql

fix

View update_from_select.sql
-- it doesn't work, don't use it
UPDATE
Table_A
SET
Table_A.col1 = Table_B.col1,
Table_A.col2 = Table_B.col2
FROM
Some_Table AS Table_A
INNER JOIN Other_Table AS Table_B