Skip to content

Instantly share code, notes, and snippets.

🎯
Focusing

Shay Elmualem Norbinsh

🎯
Focusing
  • Checkmarx
  • Mars
Block or report user

Report or block Norbinsh

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View mprocessing
import multiprocessing
import time
import datetime
import collections
import os
import requests
from pprint import pprint
def timer(func):
def function_wrapper(x):
View gist:e56becfaef077df2790c48c9566507a4
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
@Norbinsh
Norbinsh / iam_global_aws_services
Created Aug 4, 2019
DenyAllOutsideEUWEST1ExceptGlobalServices
View iam_global_aws_services
{
"Version": "2012-10-17",
"Statement": [
{
"Sid": "DenyAllOutsideEUWEST1ExceptGlobalServices",
"Effect": "Deny",
"NotAction": [
"iam:*",
"organizations:*",
"route53:*",
View gist:db84150e00d273b57416ec68757d3673
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
View cloudwatch_dashboard_widgets
def build_widget(name: str, region:str) -> dict:
return {
"type": "metric",
"width": 12,
"height": 9,
"properties": {
"metrics": [
[ "DX", "WaitingInQueue", "CustomerName", f"{name}", { "stat": "Sum" } ]
],
View nonsense
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):
View Installing Python 3.7.0 on Raspbian.rst

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).
View shasync.py
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()
View nginx-with-resolver
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;
View Asynchronous
import aiohttp
import asyncio
import os
import time
def timeit(method):
def timed(*args, **kw):
ts = time.time()
result = method(*args, **kw)
You can’t perform that action at this time.