Skip to content

Instantly share code, notes, and snippets.

View arthurdarcet's full-sized avatar

Arthur Darcet arthurdarcet

View GitHub Profile
@mikeyk
mikeyk / reconnect.diff
Created June 30, 2011 21:05
Automatically retry on AutoReconnect exception in pymongo
diff --git a/pymongo/connection.py b/pymongo/connection.py
index b444f50..7635c78 100644
--- a/pymongo/connection.py
+++ b/pymongo/connection.py
@@ -46,6 +46,7 @@ from pymongo import (database,
helpers,
message)
from pymongo.cursor_manager import CursorManager
+from pymongo.decorators import reconnect
from pymongo.errors import (AutoReconnect,
@spikegrobstein
spikegrobstein / nginx.conf
Last active August 9, 2024 13:42
nginx config for proxying requests for plex over a hostname-based virtualhost.
upstream plex-upstream {
# change plex-server.example.com:32400 to the hostname:port of your plex server.
# this can be "localhost:32400", for instance, if Plex is running on the same server as nginx.
server plex-server.example.com:32400;
}
server {
listen 80;
# server names for this server.
@rbarrois
rbarrois / mock_datetime.py
Created April 21, 2013 20:18
Proper module for patching datetime.datetime.now().
# This code is in the public domain
# Author: Raphaël Barrois
from __future__ import print_function
import datetime
import mock
@arthurdarcet
arthurdarcet / watch.py
Last active August 29, 2015 14:27
Le Bon Coin watcher
#!/usr/bin/env python3
import argparse
import bs4
import email.mime.text
import logging
import logging.config
import re
import requests
import smtplib
@rimusz
rimusz / preemtible_kubernetes.md
Last active July 7, 2018 02:52 — forked from tsuri/preemtible_kubernetes.md
kubernetes cluster w/ pre-emptible instances

Kubernetes clusters using preemtible instances

Motivation

People experimenting with kubernetes clusters on the GKE not necessarily have money to keep a full cluster on at all time. GKE clusters can be easily resized, but this still incurs in the full instance cost when the cluster is up.

Google has added preemptible instances that are ideal for many

@gccollect
gccollect / plutus_statement_to_csv.py
Last active October 23, 2024 15:26
Convert Plutus pdf statement to csv file with running balance
import re
import sys
import pandas as pd
import pdfplumber
re_transaction = re.compile(
r'(Transaction|Card Transaction|Service Fee|Card Transfer)[\n\s](\d{4}/\d{2}/\d{2}, \d{2}:\d{2})\s+(-?\s?.\d*.?\d{0,2})\n?(.*)')
re_deposit = re.compile(r'(Card Deposit|Deposit)[\n\s](\d{4}/\d{2}/\d{2}, \d{2}:\d{2})\s+(.\d*.?\d{0,2})()')
re_page = re.compile(r'\n\d{1,2}/\d{1,2}/\d{4} \d+ / \d+')