Skip to content

Instantly share code, notes, and snippets.

View sunbuhui's full-sized avatar
🌍
work from earth

pacemaker sunbuhui

🌍
work from earth
View GitHub Profile
@sunbuhui
sunbuhui / Python-assert-Keyword.md
Created March 27, 2021 03:02
Python assert Keyword

The assert keyword is used when debugging code.

The assert keyword lets you test if a condition in your code returns True, if not, the program will raise an AssertionError.

You can write a message to be written if the code returns False, check the example below.

assert word.endswith(suffix), "Given word doesn't end with given suffix"

@sunbuhui
sunbuhui / How to set http or https proxy to use shadowsocks
Created March 18, 2021 13:07
How to set http or https proxy to use shadowsocks in mac
ShadowsocksX-NG现在已经支持一键开启http代理了,只需要在mac的terminal里设置一下就好。
export http_proxy='127.0.0.1:1087'
export https_proxy='127.0.0.1:1087'
@sunbuhui
sunbuhui / Hive sql: divide rows by their id(primary key), then sort them by group
Created February 22, 2021 09:27
Hive sql: divide rows by their id/primary key, then sort them by group
```
device_id rank
12 1
12 2
12 3
10 1
10 2
```
Then use the sql below
```
@sunbuhui
sunbuhui / Info and links I need when using Hive lateral view
Last active February 19, 2021 03:28
Info and links I need when using Hive lateral view
@sunbuhui
sunbuhui / gist:06b08701ea0cc29330c38f89d0845aef
Created February 9, 2021 03:40
How to simply download a JAR using Maven?
# Replace the vals below to your jar, search it in maven repo website
mvn dependency:get -DremoteRepositories=http://repo1.maven.org/maven2/ -DgroupId=com.johnsnowlabs.nlp -DartifactId=spark-nlp-spark23_2.11 -Dversion=2.7.3
@sunbuhui
sunbuhui / My Golang cookbool
Last active December 23, 2020 04:54
My Golang cookbool
#Defer
#A defer statement defers the execution of a function until the surrounding function returns.
#The deferred call's arguments are evaluated immediately, but the function call is not executed until the surrounding function returns.
package main
import "fmt"
func main() {
defer fmt.Println("world")
@sunbuhui
sunbuhui / Install ShadowsocksR SSR in ubuntu
Last active May 14, 2021 03:10
Install ShadowsocksR/SSR in ubuntu
# It's an available ShadowsocksR repo in ubuntu
# 这是ubuntu下可用的SSR库
https://github.com/shadowsocksrr/shadowsocksr
# It's an available cross-platform ShadowsockR-GUi software repo
# 这是可用的跨平台SSR GUI开源软件
https://github.com/qingshuisiyuan/electron-ssr-backup
# If links are out of date, you can search "shadowsocksr" for ShadowsocksR, "electron-ssr" for electron-ssr
# 如果链接失效了,你可以搜 "shadowsocksr"来找到ShadowsocksR, "electron-ssr"来找到electron-ssr
# If you also encounter proxy problems, check network proxy. make sure "Socks Host"是"127.0.0.1",端口号是1080.
# Ignre Hosts should be "localhost, 127.0.0.1"