Skip to content

Instantly share code, notes, and snippets.

View shanehh's full-sized avatar
🏠

SH shanehh

🏠
View GitHub Profile
@shanehh
shanehh / t.py
Created March 2, 2021 06:47
python now time str in utc8
def utc8_now():
import datetime
dt = datetime.datetime.now() + + datetime.timedelta(hours=+8)
ts = dt.timestamp()
return datetime.datetime.utcfromtimestamp(
ts).strftime("%Y-%m-%d-%H:%M:%S") + "-UTC+8:00"
# 2021-03-02-14:45:57-UTC+8:00
@shanehh
shanehh / install-docker-compose.md
Created October 28, 2020 08:25 — forked from zacksleo/install-docker-compose.md
使用国内镜像安装 Docker Compose

使用 daocloud 镜像安装

Docker Compose 存放在Git Hub,不太稳定。 你可以也通过执行下面的命令,高速安装Docker Compose。

curl -L https://get.daocloud.io/docker/compose/releases/download/1.23.2/docker-compose-`uname -s`-`uname -m` > /usr/local/bin/docker-compose
@shanehh
shanehh / bubblesort.js
Created August 3, 2020 06:19
ES6 bubblesort
const bubbleSort = arr => {
if (!Array.isArray(arr)) {
return -1
}
if (arr.length < 2) {
return arr
}
for (let n = 0; n < arr.length; n++) {
let swapped = false
#!/usr/bin/env python3
import os
from pathlib import Path
def exec(cmd: str):
os.system(cmd)
def copy_to_clip(content: str) -> None:
t = 'echo "{}" | xclip -selection clipboard'
@shanehh
shanehh / letsco.py
Last active November 5, 2019 12:51
letsco
#!/usr/bin/env python3
"""
assume today is 2019-11-5.
now, we want to code.
> mkdir ~/Documents/py3/2019-11-05-big-deal
> code ~/Documents/py3/2019-11-05-big-deal
oh! it's boring, even though you can use !$
so, this is the script, it is equal to all of above steps: