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",
<?xml version="1.0" encoding="UTF-8"?>
<opml version="1.0">
<head>
<title>RSS subscriptions for chris.albon@gmail.com</title>
<dateCreated>Sat, 27 Feb 2021 17:33:45 +0000</dateCreated>
<ownerEmail>chris.albon@gmail.com</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/"/>
@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"/>
# -*- coding: utf-8 -*-
""" Deletes all tweets below a certain retweet threshold.
"""
import tweepy
from datetime import datetime
# Constants
CONSUMER_KEY = ''
@chrisalbon
chrisalbon / gist:0a55b7b5ef6584e672cd
Created September 8, 2014 13:46
map your google data
# coding: utf-8
# # Map Your Google Location History
#
# ## Step 1: Download your Google Location History
#
# Google makes this process very easy. Go here to [download your location history data](https://www.google.com/settings/takeout) and unzip it.
# ## Step 2: Run this script
### 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()
# Brute Force D20 Roll Simulator
# Import random module
import random
# Create a variable with a TRUE value
rolling = True
# while rolling is true
while rolling: