Install required dependencies
$ pacman -S avahi pulseaudio-zeroconf
import datetime | |
import sys | |
from typing import Optional | |
import colorama | |
import pyramid.config | |
from loguru import logger | |
from pyramid.request import Request | |
from pyramid.response import Response |
name: Back up database | |
run-name: Task | |
on: | |
schedule: | |
- cron: '0 */6 * * *' | |
# every 6 hours | |
workflow_dispatch: | |
jobs: | |
backup: | |
runs-on: ubuntu-latest |
Doctest in Python is a good design. Doctest ensures code, documentation, and tests are in a single place. So readers can understand the logic of code easier, without a lot of navigation.
Unlike Python, Ruby does not have built-in doctest, but there are some third party libraries enabling doctest in Ruby.
#!/usr/bin/env python3 | |
import socket | |
import sys | |
def main(argv): | |
multicast_group = argv[1] | |
multicast_port = int(argv[2]) | |
interface_ip = argv[3] |
# -*- coding: utf-8 -*- | |
# /var/runtime/awslambda/bootstrap.py | |
""" | |
aws_lambda.bootstrap.py | |
Amazon Lambda | |
Copyright (c) 2013 Amazon. All rights reserved. | |
Lambda runtime implemention | |
""" |
Prerequisite: latest Docker for Mac on MacOS Sierra
$ brew update
$ brew install --HEAD xhyve
$ brew install docker-machine-driver-xhyve
$ sudo chown root:wheel $(brew --prefix)/opt/docker-machine-driver-xhyve/bin/docker-machine-driver-xhyve
$ sudo chmod u+s $(brew --prefix)/opt/docker-machine-driver-xhyve/bin/docker-machine-driver-xhyve
$ curl -Lo minikube https://storage.googleapis.com/minikube/releases/v0.18.0/minikube-darwin-amd64 && chmod +x minikube && sudo mv minikube /usr/local/bin/
This gist reveals language snippets |
import boto3 | |
print(boto3.client('sts').get_caller_identity()['Account']) |
distinct column
-> For each row returned, return only the unique members of a set.
Think of it as for each row in a projection, concatenate all the column values and return only the strings that are unique.
test_db=# SELECT DISTINCT parent_id, child_id, id FROM test.foo_table ORDER BY parent_id, child_id, id LIMIT 10;
parent_id | child_id | id
-----------+------------+-----------------------------
1000040 | 103 | 1000040|2645405726|0001|103