Skip to content

Instantly share code, notes, and snippets.

View john012343210's full-sized avatar
💭
LearnAsManyAsIcan

Nameeeee john012343210

💭
LearnAsManyAsIcan
View GitHub Profile
@john012343210
john012343210 / gist:f328e8d60859667ff8b91e1e5f8dcd2a
Last active October 15, 2023 08:23
VSC prefer setting Json
{
"workbench.colorTheme": "Default High Contrast",
"github.copilot.enable": {
"*": true,
"plaintext": true,
"markdown": true,
"scminput": false,
"yaml": false,
"ini": false
},
@john012343210
john012343210 / gist:8aa653d21dd8d3b9dc9511998896ae2b
Created September 4, 2023 15:36
Example trading strategy provided by official futu
from futu import *
############################ 全局变量设置 ############################
FUTUOPEND_ADDRESS = '127.0.0.1' # Futu OpenD 监听地址
FUTUOPEND_PORT = 11111 # Futu OpenD 监听端口
TRADING_ENVIRONMENT = TrdEnv.SIMULATE # 交易环境:真实 / 模拟
TRADING_MARKET = TrdMarket.HK # 交易市场权限,用于筛选对应交易市场权限的账户
TRADING_PWD = '123456' # 交易密码,用于解锁交易
TRADING_PERIOD = KLType.K_1M # 信号 K 线周期
@john012343210
john012343210 / D3JS Tree Editor.md
Created February 26, 2021 02:08 — forked from adamfeuer/ D3JS Tree Editor.md
d3js tree editor with node create, delete, and rename
We couldn’t find that file to show.
@john012343210
john012343210 / mirror_all_githubRepo_to_Gitlab.MD
Last active February 24, 2021 01:46
sync github to gitlab
  • proposal:
    • doesnt use gitlab pull mirror or github action to push
      • approach 0: a script in a server periodically pulling the change from all github repo to local from github and pushing to gitlab.
        • problems
          • required the server to be always running, and it has to contains all the github repos in drive.
    • use gitlab pull mirror:
      • approach 1: when you create a new repo in GitHub, the webhook is sent to a script that could create a GitLab repo, and then setup the mirror
        • problems
          • there is no API to configure the pull mirror in gitlab, so it couldn't be automated.
  • [existing feature request]
@john012343210
john012343210 / bugReport
Created December 6, 2020 14:50
BugReportApiV4
query {
user(login:"AronWater") {
repositories(first:1,after:null)
{
totalCount
totalDiskUsage
pageInfo {
endCursor
hasNextPage
hasPreviousPage
@john012343210
john012343210 / test.py
Last active August 6, 2020 00:31
Getting repositories information of a user using github api v4
QUERY="""
query {
user(login:"YOURUSERNAME_HERE") {
repositories(last:100) { ######### putting 100 here might generate timeout error
totalCount
totalDiskUsage
pageInfo {
endCursor
hasNextPage
@john012343210
john012343210 / test.py
Created August 5, 2020 23:34
Getting repositories information of a user using github api v4
QUERY="""
query {
user(login:"AronWater") {
repositories(last:100) { ######### putting 100 here might generate timeout error
totalCount
totalDiskUsage
pageInfo {
endCursor
hasNextPage

the problem is that the variable i, within each of the inside anonymous functions, is bound to the same variable outside of the function.

we could just do this

function createfunc(k) { return function(i) { return i+k; }; }

function createArrayOfFunctions(y){

@john012343210
john012343210 / answer3.py
Created November 10, 2018 16:07
calculate the nearest fibonacci numbers for each element in array with O(n) with n being the size of input
from math import sqrt,log,ceil
def fibo(n):
return int((((1+sqrt(5))**n)-((1-sqrt(5))**n))/((2**n)*sqrt(5)))
def nearestFibo(array):
for k in array:
larger_Nearest_Fibo = ceil( (log(sqrt(5)*k)) /(log((1+sqrt(5))/2)) )
print(fibo(larger_Nearest_Fibo))