Skip to content

Instantly share code, notes, and snippets.

@rbw
rbw / part_of_day.py
Last active October 17, 2022 22:44
Get part of day (morning, afternoon, evening, night) in Python3.6+
#!/usr/bin/env python3
def get_part_of_day(h):
return (
"morning"
if 5 <= h <= 11
else "afternoon"
if 12 <= h <= 17
else "evening"
@sktse
sktse / code-reviews.md
Last active August 16, 2022 17:02
How to Keep Pull Requests Manageable

How to Keep Pull Requests Manageable

  • There are a lot different things you can try to keep pull requests manageable.
  • These pointers are not meant to be rules, but merely guidelines when possible. Due to the nature of what you are working on, some of these techniques may not be possible (or incredibly difficult).

More like guidelines

  • Either way, here are some tips to help make people not want to claw their eyes out reviewing a pull request.

The Basics

  • These are the fundamental basics to a pull request and ALL pull requests should have these, regardless of how small or meaningless it is.
@codingjoe
codingjoe / django_docs.md
Last active July 24, 2022 23:16
Build Django docs like a pro!

Build Django docs like a pro!

Sphinx config

docs/conf.py

import importlib
import inspect
import os
import sys
@kennwhite
kennwhite / chicken_shrimp_korma_mortal_v1.md
Last active April 17, 2019 17:24
Restaurant style chicken/prawn korma - mere mortal version (v. 1)

Kenn's Chicken/King Prawn Coconut Curry (Korma)

Ingredients

  • 2 cups red or yellow onions, well peeled, loosely chopped
  • 6 cloves peeled garlic, finely grated
  • 2" peeled ginger root, finely grated
  • Optional: 1 medium serrano green pepper, seeded & cored, finely minced (leave out for no heat, use half pepper for medium, full for spicy)
  • 14 oz plain greek yogurt (2% or whole milk, eg FAGE 5%)
  • large can (~14 oz) unsweetened coconut milk (ideally containing no guar gum; well blended if it does)
  • 3 TB cashew butter
@j-faria
j-faria / read_rdb.py
Last active June 23, 2018 17:58
.rdb file reader
import numpy as np
import cStringIO
filename = 'example.rdb'
def read_rdb(filename):
""" Reads a .rdb file with possible comments '#' and header
col1 col2 col3
---- ---- ----
Returns a numpy record array