Skip to content

Instantly share code, notes, and snippets.

View norbinsh's full-sized avatar
🏗️
Building

Shay Elmualem norbinsh

🏗️
Building
View GitHub Profile
import * as cdk from '@aws-cdk/core';
import * as ec2 from '@aws-cdk/aws-ec2';
import * as apigwv2 from '@aws-cdk/aws-apigatewayv2';
import * as apigwv2i from '@aws-cdk/aws-apigatewayv2-integrations';
import * as elbv2 from '@aws-cdk/aws-elasticloadbalancingv2'
import * as lambda from '@aws-cdk/aws-lambda';
interface ApiStackProps extends cdk.StackProps {
vpc: ec2.IVpc;
reposmanagerAlbListener: elbv2.IApplicationListener;
@norbinsh
norbinsh / gist:ea80bd062a497368470f59605abba4b8
Created October 31, 2020 19:50
default nginx container html file overwrite with local container IP - k8s pod + docker
LIP=`cat /etc/hosts | grep 10. | awk 'END{print $1}'`;echo "<html><body>container IP: ${LIP}</body></html>" > usr/share/nginx/html/index.html
package main
import (
"crypto/sha256"
"encoding/binary"
"fmt"
)
func main() {
servers := []string{"10.10.10.10", "10.10.10.11", "10.10.10.12", "10.10.10.10.13"}
// create codebuild project
const codeBuildProject = new codebuild.Project(
scope,
`${props.environment}-${props.pipelineNamePrefix}-validation`,
{
projectName: `${props.environment}-${props.pipelineNamePrefix}-validation`,
source: githubSource,
buildSpec: codebuild.BuildSpec.fromSourceFilename('buildspec_pull_request.yml'),
environment: {
buildImage: codebuild.LinuxBuildImage.AMAZON_LINUX_2,
import multiprocessing
import time
import datetime
import collections
import os
import requests
from pprint import pprint
def timer(func):
def function_wrapper(x):
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 August 4, 2019 13:28
DenyAllOutsideEUWEST1ExceptGlobalServices
{
"Version": "2012-10-17",
"Statement": [
{
"Sid": "DenyAllOutsideEUWEST1ExceptGlobalServices",
"Effect": "Deny",
"NotAction": [
"iam:*",
"organizations:*",
"route53:*",
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
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):