Skip to content

Instantly share code, notes, and snippets.

View 2018kguo's full-sized avatar
🦎
whats up

Kevin Guo 2018kguo

🦎
whats up
View GitHub Profile
@2018kguo
2018kguo / Jenkinsfile
Last active April 22, 2021 16:33
Jenkinsfile snippet #1
environment {
OCTOPUS_ID = ""
DOCKER_REGISTRY = ""
VERSION = "$BUILD_TIMESTAMP"
DEPLOY = ""
}
stages {
...
stage ("Create/Deploy Release") {
steps {
@2018kguo
2018kguo / Jenkinsfile
Last active April 22, 2021 16:34
Jenkinsfile snippet #2
environment {
OCTOPUS_ID = ""
DOCKER_REGISTRY = ""
VERSION = "$BUILD_TIMESTAMP"
DEPLOY = ""
RELEASE_NOTES = sh (script: """git log --format="medium" -1 ${GIT_COMMIT}""", returnStdout:true)
}
stages {
...
stage ("Create/Deploy Release") {
@2018kguo
2018kguo / aiohttp.py
Created April 18, 2021 19:23
web scraper aiohttp example
async def fetchHTML(self, url: str, session: ClientSession) -> str:
resp = await session.request(method="GET", url=url)
html = await resp.text()
if(len(html) == 0):
print("Hit rate limit for LinkedIn requests")
return html
async def gatherTopLevelSearchForLocations(self) -> List[str]:
htmlList = []
async with aiohttp.ClientSession() as session:
@2018kguo
2018kguo / config.yaml
Last active April 18, 2021 19:27
Web scraper config
github:
enabled: true
repoURL: "https://github.com/pittcsc/Summer2022-Internships"
linkedIn:
enabled: true
timespan: "day"
queries:
- "software engineer intern"
- "software engineering internship"
- "software development intern"
@2018kguo
2018kguo / Social.mdx
Created March 15, 2021 13:38
Sample MDX file
plugins: [
{
resolve: `gatsby-plugin-gtag`,
options: {
// your google analytics tracking id
trackingId: process.env.GOOGLE_ANALYTICS_ID,
// Puts tracking script in the head instead of the body
head: false,
// enable ip anonymization
anonymize: true,
@2018kguo
2018kguo / main.yml
Last active March 15, 2021 12:19
Workflow to deploy Gatsby site to GitHub Pages w/ Google Analytics
# This workflow to automatically build and deploy to GitHub Pages (master branch)
# when code is pushed to the dev branch
name: CI
# Controls when the action will run.
on:
# Triggers the workflow on push events but only for the dev branch
push:
branches: [ dev ]
@2018kguo
2018kguo / index.html
Created March 16, 2020 19:16
YzXLjoy
<style>
/*!
* Bootstrap v4.3.1 (https://getbootstrap.com/)
* Copyright 2011-2019 The Bootstrap Authors
* Copyright 2011-2019 Twitter, Inc.
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
*/
#test1 {
width: 45vw;
}
def buy_holdings(potential_buys, profile_data, holdings_data):
""" Places orders to buy holdings of stocks. This method will try to order
an appropriate amount of shares such that your holdings of the stock will
roughly match the average for the rest of your portfoilio. If the share
price is too high considering the rest of your holdings and the amount of
buying power in your account, it will not order any shares.
Args:
potential_buys(list): List of strings, the strings are the symbols of stocks we want to buy
symbol(str): Symbol of the stock we want to sell
def sell_holdings(symbol, holdings_data):
""" Place an order to sell all holdings of a stock.
Args:
symbol(str): Symbol of the stock we want to sell
holdings_data(dict): dict obtained from get_modified_holdings() method
"""
shares_owned = int(float(positions_data[symbol].get("quantity")))
r.order_sell_market(symbol, shares_owned)
print("####### Selling " + str(shares_owned) + " shares of " + symbol + " #######")