Skip to content

Instantly share code, notes, and snippets.

View norbinsh's full-sized avatar
🏗️
Building

Shay Elmualem norbinsh

🏗️
Building
View GitHub Profile
import aiohttp
import asyncio
import os
import time
def timeit(method):
def timed(*args, **kw):
ts = time.time()
result = method(*args, **kw)
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 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()
money_dict = {"Group": [[(17100.0, '1.07')], [(-22553.42, '1.07'), (106851.92, '1.07')], [(42000.0, '2')]]}
def recursive_tuple(data):
class TempBucket:
pass
bak = TempBucket()
bak.bucket = 0

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 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):
def build_widget(name: str, region:str) -> dict:
return {
"type": "metric",
"width": 12,
"height": 9,
"properties": {
"metrics": [
[ "DX", "WaitingInQueue", "CustomerName", f"{name}", { "stat": "Sum" } ]
],
strace: Process 11159 attached
select(0, NULL, NULL, NULL, {tv_sec=1, tv_usec=76529}) = 0 (Timeout)
openat(AT_FDCWD, "tmp.txt", O_WRONLY|O_CREAT|O_TRUNC|O_CLOEXEC, 0666) = 3
fstat(3, {st_mode=S_IFREG|0664, st_size=0, ...}) = 0
ioctl(3, TCGETS, 0x7ffeda481580) = -1 ENOTTY (Inappropriate ioctl for device)
lseek(3, 0, SEEK_CUR) = 0
ioctl(3, TCGETS, 0x7ffeda481560) = -1 ENOTTY (Inappropriate ioctl for device)
lseek(3, 0, SEEK_CUR) = 0
lseek(3, 0, SEEK_CUR) = 0
write(3, "lolz", 4) = 4
@norbinsh
norbinsh / iam_global_aws_services
Created August 4, 2019 13:28
DenyAllOutsideEUWEST1ExceptGlobalServices
{
"Version": "2012-10-17",
"Statement": [
{
"Sid": "DenyAllOutsideEUWEST1ExceptGlobalServices",
"Effect": "Deny",
"NotAction": [
"iam:*",
"organizations:*",
"route53:*",
from collections import Counter
with open("x.txt", "r") as rf:
lines = rf.readlines()
Counter(list(map(lambda x: x.split("From ")[1].split(":")[0], list(filter(lambda x: x.startswith("From "), lines)))))
"""
From 05:20:34