Skip to content

Instantly share code, notes, and snippets.

Avatar
💭
>.<

Sean Aubin Seanny123

💭
>.<
View GitHub Profile
View gist:0e49f61d60c3969d87409c0fd7b0402d
import json
import requests
yelp_auth = "nope"
def get_events( city ):
headers = { "Authorization": f"Bearer {yelp_auth}" }
params = {"location": city, "limit": 5, "term": "seafood"}
req = requests.get(
@Seanny123
Seanny123 / nvidia.sh
Created Jan 3, 2020
Dell XPS 15-7590 NVidia Install
View nvidia.sh
sudo dnf install kernel --enablerepo=updates-testing --best --allowerasing
sudo dnf config-manager --add-repo=https://negativo17.org/repos/fedora-nvidia.repo
sudo dnf update
sudo dnf -y remove "nouveau*"
sudo dnf -y install nvidia-driver akmod-nvidia nvidia-driver-cuda
@Seanny123
Seanny123 / add_shortcut.py
Last active Nov 19, 2019
Add keyboard shortcut to Gnome
View add_shortcut.py
"""Adapted from https://askubuntu.com/a/597414/168094
Example usage: python3 add_shortcut.py "xkill-short" "xkill" "<Alt><Ctrl><Shift>x"
"""
import argparse
import subprocess
parser = argparse.ArgumentParser()
parser.add_argument("name", help="Name of keyboard shortcut")
@Seanny123
Seanny123 / highlight_missing.py
Last active Jul 2, 2019
Highlight missing date ranges given a Pandas DataFrame with a DateTimeIndex
View highlight_missing.py
import numpy as np
import matplotlib.pyplot as plt
def plot_missing(df: pd.DataFrame, reg_diff, color="red"):
d_diff = np.diff(df.index)
gaps = d_diff > np.timedelta64(int(reg_diff), 'ns')
gap_sizes = d_diff[gaps]
for win_start, g_s in zip(df.index[:-1][gaps], gap_sizes):
@Seanny123
Seanny123 / date_csv.py
Created Jun 26, 2019
Parse CSV with DateTimeIndex
View date_csv.py
date_col = "datetime"
data_col = "data"
filename = "whatevs.csv"
in_df = pd.read_csv(filename,
usecols=[date_col, data_col],
infer_datetime_format=True, index_col=data_col, parse_dates=data_col)
@Seanny123
Seanny123 / savemytime_mlh.py
Created Jun 13, 2019
Get amount of time working for MLH from SaveMyTime tracker.
View savemytime_mlh.py
import pandas as pd
def mili_to_h(mili):
return mili / 60 / 60 / 1000
df = pd.read_csv("SaveMyTime export 12_06_2018 to 13_06_2019.csv")
mlh = df[df["activityName"] == "MLH"]
gitkraken_start = pd.Timestamp("2019-05-01 00:00")
ibm_start = pd.Timestamp("2019-05-20 00:00")
@Seanny123
Seanny123 / genie_rest.jl
Created Jan 2, 2019
Basic Genie REST-like server
View genie_rest.jl
using Genie
import Genie.Router: route, @params
import Base.convert
convert(::Type{Int}, s::SubString{String}) = parse(Int, s)
route("/sum/:x::Int/:y::Int") do
@Seanny123
Seanny123 / create_points.py
Created Nov 23, 2018 — forked from zsunberg/create_points.py
PyJulia Example Use Case
View create_points.py
import numpy as np
r = np.arange(1.0, 11.0, 0.1)
n = len(r)**3
pts = np.empty((n, 3))
i = 0
for x in r:
for y in r:
for z in r:
@Seanny123
Seanny123 / table.txt
Created Jun 19, 2018
Uncopyable table
View table.txt
+----+-----------------+--------+---------------------+---------------------+---------+
| id | address | build | updated_at | started_at | is_live |
+----+-----------------+--------+---------------------+---------------------+---------+
| 1 | localhost:26257 | v2.0.3 | 2018-06-19 16:39:33 | 2018-06-19 16:31:13 | true |
| 2 | localhost:26258 | v2.0.3 | 2018-06-19 16:39:33 | 2018-06-19 16:35:43 | true |
| 3 | localhost:26259 | v2.0.3 | 2018-06-19 16:39:31 | 2018-06-19 16:37:01 | true |
+----+-----------------+--------+---------------------+---------------------+---------+
@Seanny123
Seanny123 / fake_sci_dat.csv
Created Oct 28, 2017
Fake data for Code Review
View fake_sci_dat.csv
Text A Text B Text C
Brownie physics fruitcake sesame snaps. Brownie chocolate cake gingerbread jelly wafer powder toffee. Icing pastry icing cupcake powder oat cake souffle.
Cheesecake gingerbread pastry chocolate cake pudding tart. Lemon biology drops macaroon danish marzipan gummi bears sweet roll candy. Pastry toffee sweet roll.
Wafer donut tootsie roll. Jelly tart carrot cake icing apple pie halvah. Icing liquorice gingerbread chem muffin.
Candy canes jelly-o croissant. Macaroon powder danish. Icing tootsie roll apple pie
You can’t perform that action at this time.