This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import sys | |
import logging | |
import logging.config | |
from flask import Flask | |
class LoggerConfig: | |
dictConfig = { | |
'version': 1, | |
'disable_existing_loggers': False, | |
'formatters': { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/python | |
# coding=utf-8 | |
# "DATASHEET": http://cl.ly/ekot | |
from __future__ import print_function | |
import serial, struct, sys, time | |
DEBUG = 1 | |
CMD_MODE = 2 | |
CMD_QUERY_DATA = 4 | |
CMD_DEVICE_ID = 5 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import asyncio | |
import sys | |
from aio_pika import connect, Message | |
import logging | |
logging.basicConfig(stream=sys.stdout, level=logging.DEBUG) | |
logging.getLogger("pika.heartbeat").setLevel(logging.CRITICAL) | |
logging.getLogger("pika.callback").setLevel(logging.CRITICAL) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
start = time.time() | |
r = requests.get(cls.base_url) | |
while r.status_code != 200: | |
print("Server not ready..") | |
if time.time() - start > 3: | |
raise RuntimeError("Failed to Start Server") | |
time.sleep(0.01) | |
r = requests.get(cls.base_url) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
private fun storeImageToExternalStorage(imageData: String, personIdentityId: String) { | |
// TODO: refactor to add base64 string to the cached JSON | |
val offendersFile = File(mView?.getContext()?.filesDir, personIdentityId+".jpg") | |
if (offendersFile.exists()) offendersFile.delete() | |
offendersFile.createNewFile() | |
val outputStream = mView?.getContext()?.openFileOutput( | |
personIdentityId+".jpg", | |
Context.MODE_PRIVATE | |
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@mock.patch('aiodns.DNSResolver.query') | |
def test_resolve_fqdn_to_cname(self, query): | |
f = asyncio.Future() | |
f.set_result(("dummy_cname", "ttl")) | |
query.return_value = f |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
Christmas lights fading example | |
The analogWrite() function uses PWM, so if | |
you want to change the pin you're using, be | |
sure to use another PWM capable pin. On most | |
Arduino, the PWM pins are identified with | |
a "~" sign, like ~3, ~5, ~6, ~9, ~10 and ~11. | |
*/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# install dependencies | |
sudo apt-get install build-essential tk-dev libncurses5-dev libncursesw5-dev libreadline6-dev libdb5.3-dev libgdbm-dev libsqlite3-dev libssl-dev libbz2-dev libexpat1-dev liblzma-dev zlib1g-dev libffi-dev | |
# install openssl | |
./config --prefix=$HOME/openssl && make install | |
# add the path /home/pi/openssl/lib to /etc/ld.so.conf | |
ldconfig | |
# install python | |
./configure --with-openssl=/home/pi/openssl --prefix=$HOME/python38 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from datetime import datetime | |
from functools import singledispatch | |
from utils.data.data_point import DataPoint | |
@singledispatch | |
def extract_data(item, **kwargs): | |
return None # unknown type |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{'type': 'MultiPolygon', 'coordinates': [(((-58.4947729, -33.5855496), (-58.4946871, -33.5870601), (-58.4944311, -33.5880873), (-58.4938717, -33.5898933), (-58.4926272, -33.5931374), (-58.4879335, -33.6058521), (-58.484838, -33.6145478), (-58.482118, -33.625382), (-58.4772512, -33.6442167), (-58.4766394, -33.6464541), (-58.4762016, -33.6480635), (-58.4753967, -33.650208), (-58.4741008, -33.6525408), (-58.4695637, -33.6586175), (-58.4617281, -33.6687469), (-58.4519405, -33.6816091), (-58.448353, -33.6861508), (-58.4471807, -33.6881443), (-58.4430385, -33.698815), (-58.4391359, -33.7089058), (-58.4360116, -33.717055), (-58.4347009, -33.7203792), (-58.4341336, -33.7232867), (-58.4341258, -33.7249626), (-58.4344054, -33.7303622), (-58.4353137, -33.7381698), (-58.4362163, -33.7458763), (-58.4372675, -33.7529441), (-58.4376312, -33.7559226), (-58.437813, -33.7591697), (-58.4373884, -33.7659953), (-58.4366654, -33.7772091), (-58.4358353, -33.7920132), (-58.4350791, -33.8040656), (-58.435013, -33.8052057), (-58.43490 |
OlderNewer