Skip to content

Instantly share code, notes, and snippets.

View shanehh's full-sized avatar
🏠

SH shanehh

🏠
View GitHub Profile
@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:
#!/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 / 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
@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 / 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 / b站自动宽屏.js
Created March 20, 2021 04:06
b站自动宽屏
// ==UserScript==
// @name b站自动宽屏
// @author Huu Lane
// @description auto enable theater mode in bilibili.
// @version 3.0.0
// @include *://www.bilibili.com/video/*
// @namespace nobody_space
// ==/UserScript==
;(async function () {
@shanehh
shanehh / HideFilesSection.js
Created March 20, 2021 04:08
Auto click hide button at github repo page
// ==UserScript==
// @name HideFilesSection
// @namespace http://tampermonkey.net/
// @version 0.3
// @description I just need to see readme!!!
// @author lane
// @match https://github.com/*
// @exclude https://github.com/*/*/tree/*
// @grant none
// ==/UserScript==
@shanehh
shanehh / HideWikiRefer.js
Created March 20, 2021 04:09
hide wiki referer number to make copy easier
// ==UserScript==
// @name HideWikiRefer
// @namespace http://tampermonkey.net/
// @version 0.1
// @description try to take over the world!
// @author Huu
// @match https://*.wikipedia.org/wiki/*
// @match https://*.wikipedia.org/zh*/*
// @grant none
// @run-at document-end
@shanehh
shanehh / JustCopyIt.js
Created March 20, 2021 04:17
Bro, don't pollute my clipboard!
// ==UserScript==
// @name c
// @namespace http://tampermonkey.net/
// @version 0.1
// @description try to take over the world!
// @author You
// @match https://www.zhihu.com/question/*
// @match https://www.douban.com/note/*
// @grant none
// @run-at document-end
@shanehh
shanehh / create_any_MB_file.py
Created March 22, 2021 12:28
Sometimes you need to create a file of a specified size...
def create_any_MB_file(filepath, n):
with open(filepath, 'wb+') as f:
for _ in range(2**20 * n):
f.write(bytes(1))