Skip to content

Instantly share code, notes, and snippets.

Math is Beautiful

Steve-金勇 staticor

Math is Beautiful
Block or report user

Report or block staticor

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View .screenrc
# Copyright 1999-2011 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# /etc/screenrc
# This is the system wide screenrc.
# You can use this file to change the default behavior of screen system wide
# or copy it to ~/.screenrc and use it as a starting point for your own
# settings.
staticor /
Created Oct 17, 2019
class Solution:
def getRow(self, rowIndex: int) -> List[int]:
if rowIndex < 0:
return []
ans = [1]*(rowIndex+1)
for i in range(rowIndex):
ans[i+1] = ans[i]*(rowIndex-i)//(i+1)
return ans
class Solution:
def romanToInt(self, s: str) -> int:
d = {'I':1, 'IV':3, 'V':5, 'IX':8, 'X':10, 'XL':30, 'L':50, 'XC':80, 'C':100, 'CD':300, 'D':500, 'CM':800, 'M':1000}
return sum(d.get(s[max(i-1, 0):i+1], d[n]) for i, n in enumerate(s))
staticor /
Created Sep 29, 2019
Least Square Method in Linear Regression.
# Linear Least Squares
def lstsq(a, b, cond=None, overwrite_a=False, overwrite_b=False,
check_finite=True, lapack_driver=None):
Compute least-squares solution to equation Ax = b.
Compute a vector x such that the 2-norm ``|b - A x|`` is minimized.
View squirrel.custom.yaml
# squirrel.custom.yaml
# us_keyboard_layout: true # 键盘选项:应用美式键盘布局# show_notifications_when: growl_is_running # 狀態通知,默認裝有Growl時顯示,也可設爲全開(always)全關(never)
style/color_scheme: demo # 选择配色方案
style/horizontal: true# 候选窗横向显示# style/inline_preedit: false # 关闭内嵌编码,这样就可以显示首行的拼音(MAC下不建议开启)
style/corner_radius: 3# 窗口圆角半径
style/border_height: 4# 窗口边界高度,大于圆角半径才有效果
tyle/border_width: 4# 窗口边界宽度,大于圆角半径才有效果# style/line_spacing: 1 # 候选词的行间距# style/spacing: 5 # 在非内嵌编码模式下,预编辑和候选词之间的间距
style/font_face: "Lantinghei TC Extralight"# 预选栏文字字体,使用中文字体:兰亭黑-纤黑
style/font_point: 17#预选栏文字字号
staticor / azkaban-statu.sql
Last active Jun 24, 2019
View azkaban-statu.sql
select ifnull( status , 'TOTAL') status, count( flow_id ) exec_num
from (
select exec_id, project_id, flow_id
, case
when status = 50 then 'success'
when status = 60 then 'killed'
when status = 70 then 'failed'
staticor / squirrel.custom.yaml
Created Jun 5, 2019 — forked from singlepig/squirrel.custom.yaml
View squirrel.custom.yaml
# modified from
# preview
name: "RimeBlue"
horizontal: false # 候选条横向显示
inline_preedit: true # 启用内嵌编码模式,候选条首行不显示拼音
candidate_format: "%c.\u2005%@\u2005" # 用 1/6 em 空格 U+2005 来控制编号 %c 和候选词 %@ 前后的空间。
corner_radius: 10 # 候选条圆角半径
border_height: 0 # 窗口边界高度,大于圆角半径才生效
staticor /
Created May 22, 2019 — forked from andreyvit/
tmux cheatsheet

tmux cheat sheet

(C-x means ctrl+x, M-x means alt+x)

Prefix key

The default prefix is C-b. If you (or your muscle memory) prefer C-a, you need to add this to ~/.tmux.conf:

# remap prefix to Control + a
View max-stays-sequence-in-hive.hql
create table temp.result
select uid, dtnum
from (
select uid, rndiff, dtnum
, row_number() over ( partition by uid order by dtnum desc ) rk
from (
select uid, rndiff, count(dt) dtnum
from (
staticor /
Created Feb 26, 2019
Flink- example 2 计算热门商品, wuchong blog - code
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
You can’t perform that action at this time.