Skip to content

Instantly share code, notes, and snippets.

View dreynaud's full-sized avatar
🦄
about to pupate

Daniel Reynaud dreynaud

🦄
about to pupate
View GitHub Profile
@dreynaud
dreynaud / error-handling.md
Last active April 12, 2024 07:45
Error Handling in Practice

Error Handling in Practice

My experience is mostly with Java backend services in the cloud, so the advice in this post will almost certainly be biased towards this kind of error handling. But hopefully, some of it will be generally applicable and help you maintain and debug your programs in the long run.

I don't claim that these are universal best practices, but I have found these to be useful as general guidelines. As always, use your best judgment and do things that make sense in your context.

Log the whole thing

In Java, a full exception is:

@dreynaud
dreynaud / less-cheatsheet.md
Last active June 6, 2020 04:50 — forked from glnds/less-cheatsheet.md
Less Cheatsheet

Using less to navigate log files

Navigation
F follow output
ctrl+c stop following output
z forward one window
w backward one window
G go to the end of file
g go to the start of file

Keybase proof

I hereby claim:

  • I am dreynaud on github.
  • I am dreynaud (https://keybase.io/dreynaud) on keybase.
  • I have a public key ASDVeZfLi6A_AMwta1CW_smZxiVukINjTGMTZwvzN5wsFQo

To claim this, I am signing this object:

@dreynaud
dreynaud / simulate.py
Last active August 29, 2015 14:10
Hearthstone deck drawing sampler
import random
num_samples = 10 ** 6
def make_deck(special_cards):
assert(isinstance(special_cards, list))
assert(len(special_cards) <= 30)
thelist = special_cards