This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash -i | |
#using shebang with -i to enable interactive mode (auto load .bashrc) | |
set -e #stop immediately if any error happens | |
# Install Open SDK | |
apt update | |
apt install openjdk-8-jdk -y | |
update-java-alternatives --set java-1.8.0-openjdk-amd64 | |
java -version |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"version": "0.2.0", | |
"configurations": [ | |
{ | |
"name": "Chrome", | |
"type": "chrome", | |
"request": "launch", | |
"url": "http://localhost:3000", | |
"webRoot": "${workspaceRoot}/src" | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const React = require("react") | |
const StylesProvider = require("@material-ui/styles/StylesProvider").default | |
const jssPreset = require("@material-ui/styles/jssPreset").default | |
const jss = require("jss") | |
exports.wrapRootElement = ({ element }) => { | |
console.log(element) | |
return ( | |
<StylesProvider jss={jss.create({ | |
...jssPreset(), |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import React from "react" | |
import { jss } from "react-jss" | |
import { StylesProvider, ThemeProvider, useTheme } from "@material-ui/styles" | |
class SessionCheck extends React.Component { | |
constructor(props) { | |
super(props) | |
this.state = { | |
loading: true, | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# create | |
CREATE DATABASE yourdbname; | |
CREATE USER youruser WITH ENCRYPTED PASSWORD 'yourpass'; | |
GRANT ALL PRIVILEGES ON DATABASE yourdbname TO youruser; | |
#duplicate | |
CREATE DATABASE newdb WITH TEMPLATE originaldb OWNER dbuser; | |
SELECT pg_terminate_backend(pg_stat_activity.pid) FROM pg_stat_activity | |
WHERE pg_stat_activity.datname = 'originaldb' AND pid <> pg_backend_pid(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"workbench.colorTheme": "Material Theme Darker", | |
"editor.fontSize": 18, | |
"editor.tabSize": 2, | |
"editor.wordWrap": "on", | |
"terminal.integrated.fontSize": 18, | |
"emmet.includeLanguages": { | |
"edge": "html" | |
}, | |
"css.remoteStyleSheets": [ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
aTradingInfo = ts.trade_cal() | |
entry = aTradingInfo[aTradingInfo['calendarDate']==('2017/03/31')] | |
status = entry['isOpen'].values[0] | |
print status |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
url = 'http://www.sse.com.cn/market/othersdata/margin/detail/' | |
page = urlopen(url).read() | |
soup = BeautifulSoup(page, "html.parser") | |
mytest = soup.find_all("table", class_="table search_") |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
FILE_A_TRADING_Day = 'A_Trading_Day.txt' | |
FILE_HK_TRADING_Day = 'HK_Trading_Day.txt' | |
FILE_US_TRADING_Day = 'US_Trading_Day.txt' | |
today = time.strftime("%Y%m%d", time.localtime()) | |
yesterday = time.strftime("%Y%m%d", time.localtime(time.time() - 24 * 60 * 60)) | |
#Insert the latest trading day; A stock market for test | |
conn = pymysql.connect(host='172.28.249.24', user='stock_reader', passwd='stock_reader@', db='fq_base', port=13360) | |
sql = "SELECT MAX(Date) FROM fq_base.ascore2; " | |
# find the max date in the database, if it equals today, the database is ready, and it is a trading day today |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
FILE_A_TRADING_Day = 'A_Trading_Day.txt' | |
FILE_HK_TRADING_Day = 'HK_Trading_Day.txt' | |
FILE_US_TRADING_Day = 'US_Trading_Day.txt' | |
today = time.strftime("%Y%m%d", time.localtime()) | |
def line_prepender_without_verbose(filename, line): | |
with open(filename, 'r+') as f: | |
firstline = f.readline() | |
if firstline == line+'\n': |
NewerOlder