Skip to content

Instantly share code, notes, and snippets.

View discdiver's full-sized avatar

Jeff Hale discdiver

View GitHub Profile
@discdiver
discdiver / get_weather.py
Created September 20, 2023 15:28
Prefect serve method code from demo video
import requests
from prefect import flow
@flow(log_prints=True)
def fetch_weather(lat: float = 38.9, lon: float = -77.0):
weather = requests.get(
"https://api.open-meteo.com/v1/forecast/",
params=dict(latitude=lat, longitude=lon, hourly="temperature_2m"),
)
@chrisguidry
chrisguidry / stream_subscriber.py
Last active August 16, 2023 01:59
Stream the events from a Prefect Cloud workspace over Websockets
from uuid import UUID
import orjson
import pendulum
import rich.console
from websockets.client import connect
from websockets.exceptions import ConnectionClosedError
from prefect.cli import root
from prefect.cli._types import PrefectTyper
@GokulNC
GokulNC / thinkific_quiz_render_patches.html
Last active March 5, 2024 16:57
Thinkific Footer code to enable LaTeX rendering (using KaTeX) and Code Syntax Highlighting (using Highlight.js) on Quiz Sections
<!-- PATCH TO ENABLE KATEX & HIGHLIGHT.JS FOR THINKIFIC QUIZ SECTIONS -->
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/katex@0.13.0/dist/katex.min.css" integrity="sha384-t5CR+zwDAROtph0PXGte6ia8heboACF9R5l/DiY+WZ3P2lxNgvJkQk5n7GPvLMYw" crossorigin="anonymous">
<script src="https://cdn.jsdelivr.net/npm/katex@0.13.0/dist/katex.min.js" integrity="sha384-FaFLTlohFghEIZkw6VGwmf9ISTubWAVYW8tG8+w2LAIftJEULZABrF9PPFv+tVkH" crossorigin="anonymous"></script>
<script src="https://cdn.jsdelivr.net/npm/katex@0.13.0/dist/contrib/auto-render.min.js" integrity="sha384-bHBqxz8fokvgoJ/sc17HODNxa42TlaEhB+w8ZJXTc2nZf1VgEaFZeZvT4Mznfz0v" crossorigin="anonymous"></script>
<link rel="stylesheet" href="//cdnjs.cloudflare.com/ajax/libs/highlight.js/10.7.2/styles/dracula.min.css">
<script src="//cdnjs.cloudflare.com/ajax/libs/highlight.js/10.7.2/highlight.min.js"></script>
<script>
@kislayverma
kislayverma / steve-yegge-google-platform-rant.md
Created December 26, 2019 07:11
A copy (for posterity) of Steve Yegge's internal memo in Google about what platforms are and how Amazon learnt to build them

I was at Amazon for about six and a half years, and now I've been at Google for that long. One thing that struck me immediately about the two companies -- an impression that has been reinforced almost daily -- is that Amazon does everything wrong, and Google does everything right. Sure, it's a sweeping generalization, but a surprisingly accurate one. It's pretty crazy. There are probably a hundred or even two hundred different ways you can compare the two companies, and Google is superior in all but three of them, if I recall correctly. I actually did a spreadsheet at one point but Legal wouldn't let me show it to anyone, even though recruiting loved it.

I mean, just to give you a very brief taste: Amazon's recruiting process is fundamentally flawed by having teams hire for themselves, so their hiring bar is incredibly inconsistent across teams, despite various efforts they've made to level it out. And their operations are a mess; they don't really have SREs and they make engineers pretty much do everything,

@AlisonDavey
AlisonDavey / Image_Classifier_Project_fastai.ipynb
Created January 24, 2019 19:48
Oxford_Flowers_Classifier_fastai.ipynb
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@kstrauser
kstrauser / black.md
Last active March 18, 2023 00:24
Using the "black" Python formatter in VS Code

This is how to use the Black Python code formatter in VS Code.

Make a Python 3.6 virtualenv for running Black

Black itself requires Python 3.6 to run, but few of our projects are on that version. The VS Code plugin conveniently lets you run black from its own virtualenv.

I had to give a specific version of black this morning. I didn't yesterday. Don't specify the version unless it makes you (and if you do, give the current version, not the one from this doc).

$ cd ~/Envs
@davej
davej / prevent-idle.py
Created December 23, 2017 02:14
Prevent Mid 2014 MBP random shutdown
# From https://discussions.apple.com/thread/8115237
from time import sleep
while True:
sleep(0.00002)
@caseywatts
caseywatts / .inputrc
Last active March 9, 2019 16:53
BEST THING EVER
# for bash
### Search History (autocomplete style~)
# Press up-arrow for previous matching command
"\e[A":history-search-backward
# Press down-arrow for next matching command
"\e[B":history-search-forward
@baumandm
baumandm / GIF-Screencast-OSX.md
Last active November 3, 2023 07:18 — forked from dergachev/GIF-Screencast-OSX.md
OS X Screencast to Animated GIF

OS X Screencast to animated GIF

This gist shows how to create a GIF screencast using only free OS X tools: QuickTime and ffmpeg.

Forked from https://gist.github.com/dergachev/4627207. Updated to use a palette to improve quality and skip gifsicle.

Instructions

To capture the video (filesize: 19MB), using the free "QuickTime Player" application:

@subfuzion
subfuzion / curl.md
Last active May 3, 2024 09:26
curl POST examples

Common Options

-#, --progress-bar Make curl display a simple progress bar instead of the more informational standard meter.

-b, --cookie <name=data> Supply cookie with request. If no =, then specifies the cookie file to use (see -c).

-c, --cookie-jar <file name> File to save response cookies to.