Skip to content

Instantly share code, notes, and snippets.

🏋
at the gym.

Piotr Kazmierczak pkazmierczak

🏋
at the gym.
Block or report user

Report or block pkazmierczak

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
@pkazmierczak
pkazmierczak / main.py
Last active Jan 2, 2018
lambda function for automatic whitelisting of AWS IPs on an SG (python3), see https://spin.atomicobject.com/2016/03/01/aws-cloudfront-security-group-lambda/ for the original
View main.py
import copy
import json
from urllib.request import urlopen
import boto3
def handle(event, context):
response = urlopen('https://ip-ranges.amazonaws.com/ip-ranges.json')
json_data = json.loads(response.read())
View keybase.md

Keybase proof

I hereby claim:

  • I am pkazmierczak on github.
  • I am pkazmierczak (https://keybase.io/pkazmierczak) on keybase.
  • I have a public key whose fingerprint is 8249 E5DB A08C 3726 18E0 D50E CB0E 4C33 F6A3 9502

To claim this, I am signing this object:

@pkazmierczak
pkazmierczak / asw-csgo.yaml
Last active Mar 18, 2019
CounterStrike Global Offensive linux server AWS CF template
View asw-csgo.yaml
---
AWSTemplateFormatVersion: '2010-09-09'
Description: CounterStrike Global Offensive linux server template
Mappings:
AWSRegion2AMI:
eu-central-1:
AMI: ami-26c43149
eu-west-1:
AMI: ami-ed82e39e
Parameters:
View async-golang-channels.go
package main
import (
"fmt"
"time"
)
var c = make(chan int)
func factorial(name string, number int) {
View async-python2.py
import trollius as asyncio
from trollius import From
@asyncio.coroutine
def factorial(name, number):
f = 1
for i in range(2, number + 1):
print("Task %s: Compute factorial(%d)..." % (name, i))
yield From(asyncio.sleep(1))
@pkazmierczak
pkazmierczak / waf.py
Created Jan 28, 2016
WAF IPSet with troposphere
View waf.py
from troposphere import Template
from troposphere.waf import IPSet
t = Template()
t.add_description("CF Template for setting IP ranges for whitelisting on the WAF.")
Whitelist1 = t.add_resource(IPSet(
"internaladdresses",
Name="Internal_addresses",
@pkazmierczak
pkazmierczak / async-python.py
Last active Apr 12, 2019
asyncio example (python3 & python2)
View async-python.py
import asyncio
@asyncio.coroutine
def factorial(name, number):
f = 1
for i in range(2, number + 1):
print("Task %s: Compute factorial(%d)..." % (name, i))
yield from asyncio.sleep(1)
f *= i
@pkazmierczak
pkazmierczak / iam.json
Created Jan 12, 2016
AWS IAM policy for allowing access to all but the specified resources
View iam.json
{
"Version": "2012-10-17",
"Statement": [
{
"Sid": "Stmt1452600517000",
"Effect": "Allow",
"Action": [
"s3:*"
],
"NotResource": [
@pkazmierczak
pkazmierczak / aws-openvpn-cf.py
Last active Apr 12, 2016
Troposphere template for creating a simple OpenVPN server Raw
View aws-openvpn-cf.py
from troposphere import (Base64, Join, FindInMap,
Parameter, Ref, Tags, Template)
import troposphere.ec2 as ec2
# Mappings of OpenVPN AMIs
OPENVPN_AMI = {
'ap-northeast-1': {"AMI": 'ami-5ea72b5e'}, # Asia Pacific (Tokyo)
'ap-southeast-1': {"AMI": 'ami-365c5764'}, # Asia Pacific (Singapore)
'ap-southeast-2': {"AMI": 'ami-831d51b9'}, # Asia Pacific (Sydney)
@pkazmierczak
pkazmierczak / aws-openvpn-cf.json
Last active Sep 2, 2016
Cloudformation template for creating a simple OpenVPN server
View aws-openvpn-cf.json
{
"AWSTemplateFormatVersion": "2010-09-09",
"Description": "OpenVPN server template",
"Mappings": {
"AWSRegion2AMI": {
"ap-northeast-1": {
"AMI": "ami-5ea72b5e"
},
"ap-southeast-1": {
"AMI": "ami-365c5764"
You can’t perform that action at this time.