Skip to content

Instantly share code, notes, and snippets.

@FBosler
FBosler / retry.py
Last active March 19, 2022 23:50
retry.py
#Copyright 2021 Fabian Bosler
# Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation
# files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy,
# modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom
# the Software is furnished to do so, subject to the following conditions:
# The above copyright notice and this permission notice shall be included in all copies or substantial portions of the
# Software.
@FBosler
FBosler / covid19.py
Created March 15, 2020 19:24
covid-visualization
import dash
import os
import plotly.express as px
import pandas as pd
import dash_core_components as dcc
import dash_bootstrap_components as dbc
import dash_html_components as html
import json
from urllib.request import urlopen
from dash.dependencies import Input, Output
@discdiver
discdiver / common_pandas_errors.md
Last active February 2, 2022 07:40
Common Pandas Errors

Common Pandas Errors

By Jeff Hale

Pandas Version 1.x.x

See the Source file here: https://github.com/discdiver/pandas_errors

Each error is explained, an example is shown, and then the correct code is shown, if applicable.

If you have other common errors you think would be helpful for others, please leave them in the comments and ping me on Twitter @discdiver.

@Vigrond
Vigrond / celery_django_redis_ratelimit.py
Last active February 12, 2024 05:42
Celery / Django / Redis Rate Limits done "as expected" - Simple SMTP Example
# Rate limiting with Celery + Django + Redis
# Multiple Fixed Windows Algorithm inspired by Figma https://www.figma.com/blog/an-alternative-approach-to-rate-limiting/
# and Celery's sometimes ambiguous, vague, and one-paragraph documentation
#
# Celery's Task is subclassed and the is_rate_okay function is added
# celery.py or however your App is implemented in Django
import os
import math
@hpiwowar
hpiwowar / google_sheets_from_heroku.py
Last active February 15, 2025 12:43
read and write to a google spreadsheet from heroku using python
import os
import json
import gspread
from oauth2client.service_account import ServiceAccountCredentials
# based on https://www.twilio.com/blog/2017/02/an-easy-way-to-read-and-write-to-a-google-spreadsheet-in-python.html
# read that file for how to generate the creds and how to use gspread to read and write to the spreadsheet
# use creds to create a client to interact with the Google Drive API
scopes = ['https://spreadsheets.google.com/feeds']
@panique
panique / mysqldumpsplitter.sh
Created June 30, 2013 18:52
This is a copy of the the excellent MySQLDumpSplitter shell script written by KEDAR from http://kedar.nitty-witty.com. As no professional tool was able to split my massive 22GB mysqldump file to multiple files (each one containing the whole statement for one table) and this little script did the job without any errors in short time, i think this…
#!/bin/sh
# http://kedar.nitty-witty.com
#SPLIT DUMP FILE INTO INDIVIDUAL TABLE DUMPS
# Text color variables
txtund=$(tput sgr 0 1) # Underline
txtbld=$(tput bold) # Bold
txtred=$(tput setaf 1) # Red
txtgrn=$(tput setaf 2) # Green
txtylw=$(tput setaf 3) # Yellow
txtblu=$(tput setaf 4) # Blue