Skip to content

Instantly share code, notes, and snippets.

View norbinsh's full-sized avatar
🏗️
Building

Shay Elmualem norbinsh

🏗️
Building
View GitHub Profile
def build_widget(name: str, region:str) -> dict:
return {
"type": "metric",
"width": 12,
"height": 9,
"properties": {
"metrics": [
[ "DX", "WaitingInQueue", "CustomerName", f"{name}", { "stat": "Sum" } ]
],
import operator
from collections import defaultdict
NONSENSE = {
'SONG_A': 'love you baby much love i you',
'SONG_B': 'monitors could be the real monitors of the world',
'SONG_C': 'the world is a big world of worlds on earth, world'
}
def word_detector(songs_data):

Installing Python 3.7.0 on Raspbian =================================

As of July 2018, Raspbian does not yet include the latest Python release, Python 3.7.0 This means we will have to build it ourselves, and here is how to do it.

  1. Install the required build-tools (some might already be installed on your system).

import asyncio
import aiohttp
async def get_http(url):
async with aiohttp.ClientSession() as session:
async with session.get(url) as response:
return await response.text()
server {
listen 443 ssl;
server_name x.x.net;
ssl on;
client_max_body_size 0;
location / {
mirror /root_mirror;
mirror_request_body on;
proxy_pass https://b.b/partner;
proxy_ssl_verify off;
import aiohttp
import asyncio
import os
import time
def timeit(method):
def timed(*args, **kw):
ts = time.time()
result = method(*args, **kw)
import requests
import os
import time
def timeit(method):
def timed(*args, **kw):
ts = time.time()
result = method(*args, **kw)
te = time.time()
import re
import json
regex_pattern = r"^logzero_default - (\d{4}-\d\d-\d\d).*INFO: ([a-zA-Z0-9_.+-]+@[a-zA-Z0-9-]+\.[a-zA-Z0-9-.]+), \d*. (.*).zip$"
input_file = 'logfile.log'
def return_rows(input_file):
with open(input_file, 'r') as inputf:
return inputf.read().splitlines()
class Room:
def __init__(self, has_door=True):
self.has_door = has_door
self.color = "White"
def show(self):
return("Here's your door: [-]")
a = Room()
"""
Playing around with decorators.
"""
__author__ = 'Shay Elmualem'
import time
import string
from threading import Thread