Skip to content

Instantly share code, notes, and snippets.

View thinkjrs's full-sized avatar
🎯
Focusing

Jason R. Stevens, CFA thinkjrs

🎯
Focusing
View GitHub Profile
@thinkjrs
thinkjrs / dash_app_template.py
Created July 31, 2018 14:04 — forked from alysivji/dash_app_template.py
Dash app template
# standard library
import os
# dash libs
import dash
from dash.dependencies import Input, Output
import dash_core_components as dcc
import dash_html_components as html
import plotly.figure_factory as ff
import plotly.graph_objs as go
@thinkjrs
thinkjrs / nasdaq_finance.py
Created October 3, 2018 01:40 — forked from scrapehero/nasdaq_finance.py
Script to scrape financial data from NASDAQ
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from lxml import html
import requests
from time import sleep
import json
import argparse
from random import randint
//
// Regular Expression for URL validation
//
// Author: Diego Perini
// Created: 2010/12/05
// Updated: 2018/09/12
// License: MIT
//
// Copyright (c) 2010-2018 Diego Perini (http://www.iport.it)
//
from fastapi import Security, Depends, FastAPI, HTTPException
from fastapi.security.api_key import APIKeyQuery, APIKeyHeader, APIKey
from fastapi.openapi.docs import get_swagger_ui_html
from fastapi.openapi.utils import get_openapi
from starlette.status import HTTP_403_FORBIDDEN
from starlette.responses import RedirectResponse, JSONResponse
API_KEY = "1234567asdfgh"
API_KEY_NAME = "access_token"
@thinkjrs
thinkjrs / put_colon_in_offset.py
Created October 21, 2021 22:01 — forked from mattstibbs/put_colon_in_offset.py
Add a colon to timezone offset when using datetime.strftime
import datetime
original_timestamp = datetime.datetime.now()
# Convert datetime object to a string representation
timestamp_string = original_timestamp.strftime("%Y-%m-%dT%H:%M:%S%z")
print(timestamp_string)
# OUTPUT: 2019-08-17T00:00:00+0000
# Add a colon separator to the offset segment
@thinkjrs
thinkjrs / markdown-details-collapsible.md
Created November 13, 2021 04:45 — forked from pierrejoubert73/markdown-details-collapsible.md
How to add a collapsible section in markdown.

A collapsible section containing markdown

Click to expand!

Heading

  1. A numbered
  2. list
    • With some
    • Sub bullets
@thinkjrs
thinkjrs / alt-ssh-copy-id.md
Created October 15, 2022 20:25 — forked from nickbayley/alt-ssh-copy-id.md
Simple Alternative to ssh-copy-id

Simple Alternative to ssh-copy-id

Replace user with the name of the user you want to ssh as.

Replace the ip with the ip of the machine / host / vps you want to connect to.

cat ~/.ssh/id_rsa.pub | ssh user@ip "cat >> ~/.ssh/authorized_keys"
@thinkjrs
thinkjrs / README.md
Created November 30, 2022 02:14 — forked from tomi/README.md
Saving and reading private key to env variables using base64

Encoding the private key as base64

  • Copy the private key to clipboard
  • Run command pbpaste | base64 | pbcopy on mac or xclip -selection clipboard -o | base64 -w 0 | xclip -selection clipboard on 'nix systems
  • The private key is now base64 encoded in the clipboard. Paste it to env variable e.g. to heroku or to .env file

Decoding the private key from base64 in node.js

const private_key = new Buffer(process.env.PRIVATE_KEY, 'base64').toString('ascii');