Skip to content

Instantly share code, notes, and snippets.

View rosskarchner's full-sized avatar
🤘
ROLLBACK_COMPLETE

Ross M Karchner rosskarchner

🤘
ROLLBACK_COMPLETE
View GitHub Profile
@rosskarchner
rosskarchner / after.yaml
Created October 30, 2018 15:47
SAM hello world, before and after processing into plain Cloudformation
AWSTemplateFormatVersion: 2010-09-09
Outputs:
HelloWorldApi:
Description: API Gateway endpoint URL for Prod stage for Hello World function
Value: !Sub >-
https://${ServerlessRestApi}.execute-api.${AWS::Region}.amazonaws.com/Prod/hello/
HelloWorldFunctionIamRole:
Description: Implicit IAM Role created for Hello World function
Value: !GetAtt
- HelloWorldFunctionRole
@rosskarchner
rosskarchner / EMPLOYMENT OFFER 2019.eml
Created January 22, 2019 20:45
Shell oil hiring scam
Return-Path: <[email protected]>
Received: from shell.com ([37.120.146.95]) by
inbound-smtp.us-east-1.amazonaws.com with SMTP id
d8j5m6dfae652tfcrm9gpnmhp8lnv79c5re4ss01 for [email protected]; Sun, 20 Jan
2019 22:55:43 +0000
Received-SPF: fail (spfCheck: domain of shell.com does not designate
37.120.146.95 as permitted sender) client-ip=37.120.146.95;
[email protected]; helo=37.120.146.95;
Subject: EMPLOYMENT OFFER 2019
From: =?windows-1252?Q?JAMIE_WILLIAMS_-_=28HR_Dept-_SHELL_OIL_COMPANY=29?=
import csv
def format_name(response):
email_address = response['Email Address']
name = email_address.split('@')[0].replace('.', ' ').title()
return "%s (%s)" % (name, response['What is your role?'])
def response_id(field_index, response):
@rosskarchner
rosskarchner / index.py
Created March 8, 2019 15:40
automatically invalidate URL's in cloudfront when a file is updated in S3
import boto3
from botocore.vendored import requests
client = boto3.client('cloudfront')
def handler(event, context):
for record in event['Records']:
key = record['s3']['object']['key']
items = [key]
[root@d1e2b187-78bb-4979-4a61-ead7 ~]# ps ax
PID TTY STAT TIME COMMAND
1 ? Ss 0:00 /tmp/garden-init
6 ? Ss 0:01 httpd (mod_wsgi-express) -f /tmp/mod_wsgi-localhost:8000:0/httpd.conf -DMOD_WSGI_MPM_ENABLE_EVENT_MODULE -DMOD_WSGI_MPM_EXISTS_EVENT_MODULE -DMOD_WSGI_MPM_EXISTS_WOR
13 ? Ssl 0:00 /tmp/lifecycle/diego-sshd --allowedKeyExchanges= --address=0.0.0.0:2222 --allowUnauthenticatedClients=false --inheritDaemonEnv=true --allowedCiphers= --allowedMACs=
56 ? Sl 0:02 (wsgi:localhost:8000:0) -f /tmp/mod_wsgi-localhost:8000:0/httpd.conf -DMOD_WSGI_MPM_ENABLE_EVENT_MODULE -DMOD_WSGI_MPM_EXISTS_EVENT_MODULE -DMOD_WSGI_MPM_EXISTS_WOR
57 ? Sl 0:00 httpd (mod_wsgi-express) -f /tmp/mod_wsgi-localhost:8000:0/httpd.conf -DMOD_WSGI_MPM_ENABLE_EVENT_MODULE -DMOD_WSGI_MPM_EXISTS_EVENT_MODULE -DMOD_WSGI_MPM_EXISTS_WOR
72 ? Ssl 0:00 /etc/cf-assets/healthcheck/healthcheck -port=8000 -timeout=1000ms -liveness-interval=30
@rosskarchner
rosskarchner / gist:2381ca5f8136f72b3718ca8353a7d5cc
Last active July 16, 2023 14:13
Notes from Elasticsearch Engineer II training
  • Elasticsearch Internals
    • Lucene Indexing
      • Java Library
      • Shard
        • A shard is an instance of Lucene
        • max # of documents in a shard is Integer.MAX_VALUE - 128
        • clients do not refer to shards directly (use index instead
        • What's in a shard?
          • indexed document gets analyzed, put in buffer
  • buffer defaults to 10% of node heap (set with indices.memory.index_buffer_size)
FROM centos:7
RUN yum install -y centos-release-scl https://download.postgresql.org/pub/repos/yum/10/redhat/rhel-7-x86_64/pgdg-centos10-10-2.noarch.rpm && \
yum install -y rh-python36 rh-python36-mod_wsgi httpd24 postgresql10 && \
echo "source scl_source enable rh-python36" > /etc/profile.d/scl_python.sh && \
echo "source scl_source enable httpd24" > /etc/profile.d/scl_httpd.sh && \
source /etc/profile && \
pip3 install --no-cache-dir -U pip setuptools wheel virtualenv && yum clean all && rm -rf /var/cache/yum

Network Defense Management

Network Attacks and Defense Strategies

Explain essential terminologies related to network security attacks

Describe the various examples of network-level attack techniques

Describe the various examples of host-level attack techniques

AWSTemplateFormatVersion: '2010-09-09'
Transform: AWS::Serverless-2016-10-31
Resources:
ServerlessRestApi:
Type: 'AWS::Serverless::Api'
Properties:
StageName: Prod
DefinitionBody:
info:
func _integrate_forces(state):
# enforce min and max speed
# based on: https://godotengine.org/qa/44040/how-to-set-a-max-speed-of-a-rigidbody2d?show=44086#c44086
# no, I don't totally understand the math
state.linear_velocity=state.linear_velocity.normalized()*clamp(state.linear_velocity.length(), 700, 1000)