Using Python's built-in defaultdict we can easily define a tree data structure:
def tree(): return defaultdict(tree)
That's it!
[Unit] | |
Description=Sidekiq workers | |
# start as many workers as you want here | |
Wants=sidekiq@1.service | |
Wants=sidekiq@2.service | |
# ... | |
[Service] | |
Type=oneshot | |
ExecStart=/bin/true |
/* bling.js */ | |
window.$ = document.querySelectorAll.bind(document); | |
Node.prototype.on = window.on = function (name, fn) { | |
this.addEventListener(name, fn); | |
} | |
NodeList.prototype.__proto__ = Array.prototype; |
Using Python's built-in defaultdict we can easily define a tree data structure:
def tree(): return defaultdict(tree)
That's it!
import logging | |
from django.contrib.gis.db.backends.postgis.base import \ | |
DatabaseWrapper as PostgisDBWrapper | |
from django.db import ProgrammingError | |
from .schema import TimescaleSchemaEditor | |
logger = logging.getLogger(__name__) |
git branch -m old_branch new_branch # Rename branch locally | |
git push origin :old_branch # Delete the old branch | |
git push --set-upstream origin new_branch # Push the new branch, set local branch to track the new remote |
brew install caddy mkcert nss dnsmasq | |
mkcert -install | |
mkcert '*.app.test' '*.cdn.test' | |
# rename the certs and move them under /usr/local/etc/caddy/certs | |
cat <<EOF > /usr/local/etc/caddy/Caddyfile | |
*.app.test:443, *.cdn.test:443 { |
/* | |
* Динамическая сетка | |
* Внедряется подмешиванием DOM-узлу поведенческих классов: grid_col_3, grid_cell... | |
*/ | |
.grid | |
box-sizing border-box | |
/* | |
* Генерирует стили для сетки |
Ansible playbook to setup HTTPS using Let's encrypt on nginx. | |
The Ansible playbook installs everything needed to serve static files from a nginx server over HTTPS. | |
The server pass A rating on [SSL Labs](https://www.ssllabs.com/). | |
To use: | |
1. Install [Ansible](https://www.ansible.com/) | |
2. Setup an Ubuntu 16.04 server accessible over ssh | |
3. Create `/etc/ansible/hosts` according to template below and change example.com to your domain | |
4. Copy the rest of the files to an empty directory (`playbook.yml` in the root of that folder and the rest in the `templates` subfolder) |
""" | |
This file is executed when the Python interactive shell is started if | |
$PYTHONSTARTUP is in your environment and points to this file. It's just | |
regular Python commands, so do what you will. Your ~/.inputrc file can greatly | |
complement this file. | |
Modified from sontek's dotfiles repo on github: | |
https://github.com/sontek/dotfiles | |
""" |
#!/usr/bin/env python | |
# -*- coding: utf-8 -*- | |
import urllib2 | |
gh_url = 'https://api.github.com' | |
req = urllib2.Request(gh_url) | |
password_manager = urllib2.HTTPPasswordMgrWithDefaultRealm() |