Install required dependencies
$ pacman -S avahi pulseaudio-zeroconf
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.
# -*- 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
var uuid = require("node-uuid"); | |
// Create a message to be consumed by the queuedemo.tasks.add Celery task | |
// will incorporate arguments x & y as part of `add(x,y)` message | |
function makeCeleryAddMessage(x, y){ | |
var msgId = uuid.v4(); | |
// This is the outer AMQP envelope | |
var msgEnvelope = { |
P4A_pyjnius_DIR=~/code/pyjnius ./distribute.sh -b minimal -m 'pyjnius python' -u pyjnius | |
cd .; ./build.py --package org.minimal.test --name _MINIMAL --version 1 --private ~/code/testmininal --asset debug installd | |
adb logcat *:S python:D | |
''' | |
Bluetooth/Pyjnius example | |
========================= | |
This was used to send some bytes to an arduino via bluetooth. | |
The app must have BLUETOOTH and BLUETOOTH_ADMIN permissions (well, i didn't | |
tested without BLUETOOTH_ADMIN, maybe it works.) | |
Connect your device to your phone, via the bluetooth menu. After the | |
pairing is done, you'll be able to use it in the app. |