Skip to content

Instantly share code, notes, and snippets.

@rsperl
rsperl / nmap_examples.md
Last active December 14, 2025 04:08
nmap examples #snippet
@mariocj89
mariocj89 / python-logging.md
Last active June 25, 2026 07:57
Understanding logging in Python

Logging trees

Introduction

When applications are running in production, they become black boxes that need to be traced and monitored. One of the simplest, yet main, ways to do so is logging. Logging allows us - at the time we develop our software - to instruct the program to emit information while the system is running that will be useful for us and our sysadmins.

@singledigit
singledigit / cognito.yaml
Last active September 20, 2025 17:27
Create a Cognito Authentication Backend via CloudFormation
AWSTemplateFormatVersion: '2010-09-09'
Description: Cognito Stack
Parameters:
AuthName:
Type: String
Description: Unique Auth Name for Cognito Resources
Resources:
# Creates a role that allows Cognito to send SNS messages
SNSRole:
@carlsmith
carlsmith / replace.py
Created April 5, 2017 02:08
A Python function that does multiple string replace ops in a single pass.
import re
def replace(string, substitutions):
substrings = sorted(substitutions, key=len, reverse=True)
regex = re.compile('|'.join(map(re.escape, substrings)))
return regex.sub(lambda match: substitutions[match.group(0)], string)
@atjones0011
atjones0011 / get_attachment.py
Last active August 3, 2020 20:29
get_attachment code
def get_attachment(msg, content_type):
"""
Moves through a tree of email Messages to find an attachment.
:param msg: An email Message object containing an attachment in its Message tree
:param content_type: The type of attachment that is being searched for
:return: An email Message object containing base64 encoded contents (i.e. the attachment)
"""
attachment = None
msg_content_type = msg.get_content_type()
@5agado
5agado / Pandas and Seaborn.ipynb
Created February 20, 2017 13:33
Data Manipulation and Visualization with Pandas and Seaborn — A Practical Introduction
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@halberom
halberom / 01_play.yml
Created February 1, 2017 17:53
ansible - example of getting a flattened list of values from a nested list within a dict
---
- hosts: localhost
gather_facts: no
vars:
postgresql_users:
prod:
- group: ca
users:
- user1
- user2
@angrychimp
angrychimp / sftp-setup-ssh-keys.sh
Created January 24, 2017 18:37
Setting up SSH keys for key-auth with ProFTPd (w/ SFTP module)
#!/bin/bash
USERNAME="your username here"
SFTPHOST="your sftp host"
SFTPPORT=22 # or other port, if non-standard
# Create SSH key-pair for SFTP access
# (creates pair with no passphrase)
ssh-keygen -b 2048 -t rsa -C "$SFTPHOST" -N "" -f ~/.ssh/id_rsa.sftp
@crawles
crawles / Spark Dataframe Cheat Sheet.py
Last active December 19, 2025 20:11 — forked from evenv/Spark Dataframe Cheat Sheet.py
Cheat sheet for Spark Dataframes (using Python)
# A simple cheat sheet of Spark Dataframe syntax
# Current for Spark 1.6.1
# import statements
from pyspark.sql import SQLContext
from pyspark.sql.types import *
from pyspark.sql.functions import *
#creating dataframes
df = sqlContext.createDataFrame([(1, 4), (2, 5), (3, 6)], ["A", "B"]) # from manual data
@leonardofed
leonardofed / README.md
Last active May 26, 2026 06:57
A curated list of AWS resources to prepare for the AWS Certifications


A curated list of AWS resources to prepare for the AWS Certifications

A curated list of awesome AWS resources you need to prepare for the all 5 AWS Certifications. This gist will include: open source repos, blogs & blogposts, ebooks, PDF, whitepapers, video courses, free lecture, slides, sample test and many other resources.