Skip to content

Instantly share code, notes, and snippets.

View chrisalbon's full-sized avatar

Chris Albon chrisalbon

View GitHub Profile
@chrisalbon
chrisalbon / gist:9affdbe840ac0a30fd5d0faa63169eb0
Created March 2, 2024 19:18
VSCode Terminal <-> File keyboard shortcut
// Place your key bindings in this file to override the defaults
[
// Toggle between terminal and editor focus
{
"key": "ctrl+`",
"command": "workbench.action.terminal.focus"
},
{
"key": "ctrl+`",
"command": "workbench.action.focusActiveEditorGroup",
@chrisalbon
chrisalbon / main.py
Last active July 5, 2023 00:23
Three Legged Auth To Tweet Something
import tweepy
from dotenv import load_dotenv
import os
# Constants
load_dotenv()
#Secrets
CONSUMER_KEY = os.getenv("CONSUMER_KEY")
CONSUMER_SECRET = os.getenv("CONSUMER_SECRET")
@chrisalbon
chrisalbon / gist:d3fb732e97cfb2e06c65f7a84e2b4fe2
Last active May 29, 2023 20:11
Quick And Dirty GPU Speed Test
"""
This module imports necessary libraries from PyTorch, torchvision, and sets up the device configuration for CUDA if available.
It then sets hyperparameters for an application of a fully connected neural network on the MNIST dataset of handwritten digits.
The MNIST dataset is loaded, transformed into tensors, and split into a training and a test dataset.
The fully connected neural network architecture is defined with one hidden layer, after which the model is initiated.
CrossEntropyLoss is used as the loss function, and Adam optimizer is used for optimization.
Training is done for the specified number of epochs, where for each epoch, forward pass is performed, loss is calculated,
backpropagation is applied, and the model parameters are updated.
<opml version="1.0">
<head>
<dateCreated>Mon, 21 Nov 2022 20:41:45 +0000</dateCreated>
</head>
<body>
<outline text="FastML" title="FastML" type="rss" xmlUrl="http://fastml.com/atom.xml" htmlUrl="http://fastml.com/"/>
<outline text="colah's blog" title="colah's blog" type="rss" xmlUrl="http://colah.github.io/rss" htmlUrl="http://colah.github.io/"/>
<outline text="Math ∩ Programming" title="Math ∩ Programming" type="rss" xmlUrl="https://jeremykun.com/feed/" htmlUrl="https://jeremykun.com"/>
<outline text="Pete Warden's blog" title="Pete Warden's blog" type="rss" xmlUrl="https://petewarden.com/feed/" htmlUrl="https://petewarden.com"/>
<outline text="Two Minute Papers" title="Two Minute Papers" type="rss" xmlUrl="https://www.youtube.com/feeds/videos.xml?channel_id=UCbfYPyITQ-7l4upoX8nvctg" htmlUrl="https://www.youtube.com/channel/UCbfYPyITQ-7l4upoX8nvctg"/>
<?xml version="1.0" encoding="UTF-8"?>
<opml version="1.0">
<head>
<title>RSS subscriptions for [email protected]</title>
<dateCreated>Sat, 27 Feb 2021 17:33:45 +0000</dateCreated>
<ownerEmail>[email protected]</ownerEmail>
</head>
<body>
<outline text="Google AI Blog" title="Google AI Blog" type="rss" xmlUrl="http://feeds.feedburner.com/blogspot/gJZg" htmlUrl="http://ai.googleblog.com/"/>
<outline text="FastML" title="FastML" type="rss" xmlUrl="http://fastml.com/atom.xml" htmlUrl="http://fastml.com/"/>
# -*- coding: utf-8 -*-
""" Deletes all tweets below a certain retweet threshold.
"""
import tweepy
from datetime import datetime
# Constants
CONSUMER_KEY = ''
### Keybase proof
I hereby claim:
* I am chrisalbon on github.
* I am chrisalbon (https://keybase.io/chrisalbon) on keybase.
* I have a public key ASBI8zFqR11PMiDce5FTxa7M57P8WLTxMkdLD-tt72qjjAo
To claim this, I am signing this object:
import pandas as pd
index = pd.date_range('1/1/2000', periods=20000, freq='30min')
series = pd.Series(range(20000), index=index)
series.groupby(series.index.hour).sum()
{'Alabama': 4849377,
'Alaska': 736732,
'Arizona': 6731484,
'Arkansas': 2966369,
'California': 38802500,
'Colorado': 5355866,
'Connecticut': 3596677,
'Delaware': 935614,
'District of Columbia': 658893,
'Florida': 19893297,
@chrisalbon
chrisalbon / gist:2d07b745a7e378cd2685
Created July 1, 2015 17:15
Testing Popily Embeds In Project Jupyter
{
"cells": [
{
"cell_type": "markdown",
"metadata": {},
"source": [
"# Testing Popily Embeds In Project Jupyter"
]
},
{