Skip to content

Instantly share code, notes, and snippets.

View ochsec's full-sized avatar

Christopher Ochsenreither ochsec

View GitHub Profile
df = pd.DataFrame(russell_list)
col_names = col_names[1:] # Drop Id column
df = df[col_names]
df.set_index('Symbol')
for col_name in ['Price', 'Change', '% Change', 'YTDchange']:
df[col_name] = pd.to_numeric(df[col_name], errors='coerce')
conn = sqlite3.connect('quotes.sqlite')
# Helper functions
def dict_factory(cursor, row):
"""Create a custom factory for generating dictionaries from table rows"""
d = {}
for idx, col in enumerate(cursor.description):
d[col[0]] = row[idx]
return d
@ochsec
ochsec / gist:794b11e18f63951406ce18da34eee638
Created September 25, 2020 18:25
russell_select_result.txt
┌────────┬─────────────────────────┬───────┬───────────┬─────┬──────┬──────┬─────────────┬─────────────┬────────────┬─────────────────────┐
│ Symbol │ Company │ Price │ YTDchange │ Buy │ Hold │ Sell │ Target High │ Target Mean │ Target Low │ Last Updated │
╞════════╪═════════════════════════╪═══════╪═══════════╪═════╪══════╪══════╪═════════════╪═════════════╪════════════╪═════════════════════╡
│ AHT │ ASHFORD HOSPITALITY │ 1.53 │ -94.52 │ 7 │ 3 │ 1 │ 2 │ 1.51 │ 0.75 │ 2020-07-21 00:00:00 │
├────────┼─────────────────────────┼───────┼───────────┼─────┼──────┼──────┼─────────────┼─────────────┼────────────┼─────────────────────┤
│ PEI │ PENNSYLVANIA REAL ESTAT │ 0.53 │ -90.1 │ 0 │ 8 │ 6 │ 1 │ 0.9 │ 0.7 │ 2020-09-21 00:00:00 │
├────────┼─────────────────────────┼───────┼───────────┼─────┼──────┼──────┼─────────────┼─────────────┼────────────┼─────────────────────┤
│ CPE │ CALLON PETROLEUM CO │ 4.89 │
@ochsec
ochsec / estimates.py
Last active September 21, 2020 16:51
import os
import requests
from dotenv import load_dotenv
load_dotenv()
API_KEY = os.getenv('FINNHUB_KEY')
API_V1 = os.getenv('FINNHUB_API_V1')
def get_stock_estimates(ticker, exchange='US'):
import sqlite3
import pandas as pd
import termtables as tt
import estimates
conn = sqlite3.connect('quotes.sqlite')
# Helper functions
def dict_factory(cursor, row):
import re
import sqlite3
import russell_scraper
conn = sqlite3.connect('quotes.sqlite')
cur = conn.cursor()
def create_table(headers):
sql = '''CREATE TABLE "Russell2000" (
import requests
from bs4 import BeautifulSoup
import time
CNN_URL="https://money.cnn.com/data/markets/russell?page="
def scrape_russell_2000():
page_exists = True
page_num = 1
@ochsec
ochsec / pbkdf2.js
Created June 26, 2020 21:42 — forked from xfoxfu/pbkdf2.js
ASP.NET Core PBKDF2 Password Validation in Node.js
var crypto = require("crypto");
var hashedPassword = Buffer.from(
"AQAAAAEAACcQAAAAEPSiQdZVf3bivGCbaXPnuhozdt8k4cCphxfuc25NBGIioJV9deDyFK9awIow1HfR2A==",
"base64",
);
var password = Buffer.from("Admin888`");
const getPBKDF2Algorithm = prf => {
switch (prf) {
Node Version Manager
https://github.com/nvm-sh/nvm
Nodemailer
npmjs: https://www.npmjs.com/package/nodemailer
site: https://nodemailer.com/about/
AWS SDK
Homepage: https://aws.amazon.com/sdk-for-node-js/
Docs: https://docs.aws.amazon.com/AWSJavaScriptSDK/latest/index.html
@ochsec
ochsec / favorite.component.ts
Created June 16, 2017 04:55
Event Emitter Component
// glyphicon component that emits change event
import { Component, Input, Output, EventEmitter } from '@angular/core';
@Component({
selector: 'favorite',
template: `
<i [class]="isFavorite ? 'glyphicon glyphicon-star' : 'glyphicon glyphicon-star-empty'" (click)="onClick()"></i>
`
})