Skip to content

Instantly share code, notes, and snippets.

View duncangh's full-sized avatar
💭
👨‍💻

Graham Duncan duncangh

💭
👨‍💻
View GitHub Profile
@duncangh
duncangh / readme.md
Last active September 12, 2024 13:26
Scroll to bottom of *infinite* timeline Javascript

Autoscroll Twitter Timeline

Want to quickly find your regrettable 10 year old tweets without having to learn how to use the twitter API or scroll manually through the infinite ether of the bad takes you've tweeted throughout the ages?

Then this is for you, ya lazy human. Just paste in the console and watch those hot takes go by.

function autoScrolling() {
   window.scrollTo(0,document.body.scrollHeight);
}
@duncangh
duncangh / developer-blogs.md
Created May 20, 2022 00:41
Might fuck around and make a list of developer blogs cuz my bookmarks are a nightmare

Developer blogs I've found and like

Individual run websites, so will exclude examples like "Netflix Engineering Blog" etc

  • todo: export chrome bookmarks and make the links pretty with markdown
  • todo: get more than one so this doesn't look like another abandoned project in my gist graveyard

https://www.craigkerstiens.com/ https://simonwillison.net/

@duncangh
duncangh / s3_to_pandas.py
Created April 7, 2019 03:01 — forked from jaklinger/s3_to_pandas.py
Read CSV (or JSON etc) from AWS S3 to a Pandas dataframe
import boto3
import pandas as pd
from io import BytesIO
bucket, filename = "bucket_name", "filename.csv"
s3 = boto3.resource('s3')
obj = s3.Object(bucket, filename)
with BytesIO(obj.get()['Body'].read()) as bio:
df = pd.read_csv(bio)
@duncangh
duncangh / investing.py
Created April 1, 2023 05:00 — forked from elibroftw/investing.py
A Python script and tool for speeding up stock market research.
"""
Investing Quick Analytics
Author: Elijah Lopez
Version: 1.49
Created: April 3rd 2020
Updated: March 16th 2021
https://gist.github.com/elibroftw/2c374e9f58229d7cea1c14c6c4194d27
Resources:
Black-Scholes variables:
import requests
import pandas as pd
import plotly.graph_objects as go
import pandas as pd
from datetime import datetime
api_key = 'your api key from financialmodelingprep'
@duncangh
duncangh / jinja-example.json
Last active November 11, 2021 00:09 — forked from sevennineteen/example.json
Example using Jinja2 to populate a JSON payload template
{ "path": "/content/geometrixx/my-first-jinja-page",
"properties": [
{ "name": "jcr:primaryType",
"value": "cq:Page" }],
"nodes": [
{ "path": "jcr:content",
"properties": [
{ "name": "jcr:primaryType",
"value": "cq:PageContent"},
@duncangh
duncangh / Collect Parler Metadata.ipynb
Created January 12, 2021 06:37 — forked from kylemcdonald/Collect Parler Metadata.ipynb
Collect video URLs and GPS data for Parler videos.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@duncangh
duncangh / 2019_race_results.json
Last active January 5, 2021 00:18
Catch the Leprechan Race Results Data
{"headings":[{"key":"race_placement","name":"Place","style":"place"},{"key":"bib_num","name":"Bib","align":"right","style":"bib"},{"key":"name","name":"Name"},{"key":"gender","name":"Gender"},{"key":"city","name":"City"},{"key":"age","name":"Age","align":"right"},{"key":"age_performance_percentage","tooltip":"This shows how well you performed based on your age. Higher numbers are better, with 100% being the best.","name":"Age\nPercentage","align":"right"},{"key":"division_place","nonSortable":true,"name":"Division\nPlace","align":"right","style":"place"},{"key":"division","nonSortable":true,"name":"Division"}],"resultSet":{"setInfo":{"individual_result_set_id":146666,"race_category_id":228991,"individual_result_set_name":"5K","public_results":"T","results_source_name":"GO Race Productions","results_source_url":null,"preliminary_results":"F","individual_result_set_deleted":"F","disable_division_placement_calc":"T","pace_type":"T","result_questions_url":null,"hide_splits_in_results":"F","hide_event_names":"F",
@duncangh
duncangh / README.md
Created October 17, 2020 02:54 — forked from parente/README.md
Jupyter Tidbit: Display an image gallery

Summary

JupyterLab and Jupyter Notebook can display HTML-embedded images in notebook documents. You can use the IPython.display.HTML class to structure these images into a basic image gallery.

Example

Binder

The notebook below defines a gallery() function that accepts a list of image URLs, local image

@duncangh
duncangh / an_oop_umph_concert_simulator.py
Last active October 2, 2020 01:24
Umphreys Songs and frequencies
import random
import pandas as pd
import numpy as np
# import requests
# from bs4 import BeautifulSoup as bs
# base_setlist_url = "https://allthings.umphreys.com/setlists/2020.html"
df= pd.read_csv('https://gist.githubusercontent.com/duncangh/f732e79528c809c6affcfcbfaa087cba/raw/393a5861d749b0f1b60879038ce70eca99fe3517/songs.csv')