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 apache_beam as beam | |
from apache_beam.options.pipeline_options import PipelineOptions | |
from typing import Iterable | |
import dataclasses | |
@dataclasses.dataclass | |
class Person: | |
GENDER_MALE = "m" | |
GENDER_FEMALE = "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
import json | |
import boto3 | |
import base64 | |
import os | |
def lambda_handler(event, context): | |
client = boto3.client('route53') | |
username,password = base64.b64decode(event.get("headers").get("Authorization").replace("Basic ", "")).decode().split(":") | |
if not password or not password == os.environ.get("password"): |
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 socket | |
import time | |
import uuid | |
import struct | |
instance_id = uuid.uuid4().hex | |
payload = "this is data" | |
multicast_group = ('224.31.5.85', 19845) | |
discovery = socket.socket(socket.AF_INET, socket.SOCK_DGRAM, socket.IPPROTO_UDP) |
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
name = "Hubert" | |
class Thing(): | |
attributes = { | |
"size": 12, | |
"weigth": 20, | |
"name": "a thing" | |
} | |
@property |
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 flask import Flask, redirect, request | |
import hashlib | |
import re | |
app = Flask(__name__) | |
# plays best with ngrok proxy server https://ngrok.com/ | |
@app.route("/") | |
def hello(): |
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 | |
import time | |
import threading | |
import Queue | |
import random | |
class BaseSynchronisation(object): | |
num_threads = 5 | |
threads = None |
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
<?php | |
function base64url_encode($data) { | |
return rtrim(strtr(base64_encode($data), '+/', '-_'), '='); | |
} | |
// payload | |
$data = array("username"=>"John"); | |
$data_json = json_encode($data); | |
$dataz = gzcompress($data_json); | |
if(strlen($dataz) < (strlen($data_json) - 1)) |
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
<?php | |
class X { | |
public $name; | |
public function __construct($name) { | |
$this->name = $name; | |
} | |
# This must be defined in order to have array_diff() working | |
#public function __toString() { | |
# return $this->name; |
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 hypchat import HypChat | |
import re | |
import sys | |
import argparse | |
import select | |
from hypchat.requests import HttpClientError | |
parser = argparse.ArgumentParser(description='Simply sends a message to a given room') | |
parser.add_argument('-t', '--token', action='store', dest="apitoken", default='xxxxxx') | |
parser.add_argument('-r', '--room', action='store', dest="room", default='rnd') |
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 random | |
import math | |
teamof = 2 | |
def teams(people): | |
teams = [] | |
for i in range(len(people) / teamof): | |
team = [] | |
for i in range(teamof): | |
p = random.choice(people) |
NewerOlder