Skip to content

Instantly share code, notes, and snippets.

@hrldcpr
hrldcpr / tree.md
Last active June 8, 2024 18:11
one-line tree in python

One-line Tree in Python

Using Python's built-in defaultdict we can easily define a tree data structure:

def tree(): return defaultdict(tree)

That's it!

@paulmillr
paulmillr / active.md
Last active June 10, 2024 18:10
Most active GitHub users (by contributions). http://twitter.com/paulmillr

Most active GitHub users (git.io/top)

The count of contributions (summary of Pull Requests, opened issues and commits) to public repos at GitHub.com from Wed, 21 Sep 2022 till Thu, 21 Sep 2023.

Only first 1000 GitHub users according to the count of followers are taken. This is because of limitations of GitHub search. Sorting algo in pseudocode:

githubUsers
 .filter(user => user.followers > 1000)
@utek
utek / Exclude_tables.md
Last active June 6, 2024 08:11
Define ignored tables in alembic.ini

Add this in your ini file:

[alembic:exclude]
tables = spatial_ref_sys

In env.py:

    import re 
    
@rstacruz
rstacruz / ansible.md
Last active April 8, 2024 23:36
Getting started with Ansible
@staltz
staltz / introrx.md
Last active June 13, 2024 19:58
The introduction to Reactive Programming you've been missing
@eatonphil
eatonphil / py_js_oo.py
Last active August 29, 2015 14:17
Javascript-Style Objects in Python
# After spending too much time away from Python on Javascript, I gave this a shot. To my surprise, it worked!
# Since Python doesn't bind "self" implicitly in classes, this looks pretty similar to Python classes.
# You want inheritance? Pass in the Parent "class" and copy the key/vals a la Javascript.
# Even adding dot syntax is not too tough.
def Cat(legs, colorId, name):
def sayHi():
print 'Hi, my name is %s. I have %s legs and am %s.' % (this['name'], this['legs'], this['color'])
this = {
{
"title": "Leopold FC660 Capslock to FN w/ function keys and escape",
"rules": [
{
"description": "Map capslock to fn",
"manipulators": [
{
"conditions": [{ "type": "device_if", "identifiers": [{
"product_id": 257, "vendor_id": 1204
}]}],