jq is useful to slice, filter, map and transform structured json data.
brew install jq
#!/usr/bin/env python | |
from __future__ import print_function, unicode_literals | |
import operator | |
import psycopg2 | |
import psycopg2.extras | |
import io | |
import json | |
import sys | |
import logging |
#!/usr/bin/env python | |
import signal | |
import sys | |
def signal_handler(signal, frame): | |
sys.exit(0) | |
signal.signal(signal.SIGINT, signal_handler) |
Should be work with 0.18
Destructuring(or pattern matching) is a way used to extract data from a data structure(tuple, list, record) that mirros the construction. Compare to other languages, Elm support much less destructuring but let's see what it got !
myTuple = ("A", "B", "C")
myNestedTuple = ("A", "B", "C", ("X", "Y", "Z"))
# npm using https for git | |
git config --global url."https://github.com/".insteadOf [email protected]: | |
git config --global url."https://".insteadOf git:// | |
# npm using git for https | |
git config --global url."[email protected]:".insteadOf https://github.com/ | |
git config --global url."git://".insteadOf https:// |
Create a template service file at /etc/systemd/system/[email protected]
. The template parameter will correspond to the name
of target host:
[Unit]
Description=Setup a secure tunnel to %I
After=network.target
No, seriously, don't. You're probably reading this because you've asked what VPN service to use, and this is the answer.
Note: The content in this post does not apply to using VPN for their intended purpose; that is, as a virtual private (internal) network. It only applies to using it as a glorified proxy, which is what every third-party "VPN provider" does.
# tag target commits as demo-start, demo-end | |
# move to the start of your presentration with `git checkout demo-start` | |
# use to `git next`, `git prev` to jump between "slides" | |
git config --global alias.next '!git checkout `git rev-list HEAD..demo-end | tail -1`' | |
git config --global alias.prev 'checkout HEAD^' |
""" | |
Test performance of these counting methods: | |
- count_if_else: Set to 1 if not yet seen and increment otherwise | |
- count_if: Set to 0 if not yet seen, then increment regardless of containment | |
- count_exception: Attempt to increment and set to 1 if KeyError caught | |
- count_setdefault: Set default value to 0, then increment | |
- count_fromkeys: Create dict with necessary keys set to 0, then increment each | |
- count_set_and_comprehension: Create dict of items and counts using a set | |
- count_defaultdict: Increment count, automatically setting unseen values to 0 |