Skip to content

Instantly share code, notes, and snippets.

View jonathanhle's full-sized avatar

Jonathan Le jonathanhle

View GitHub Profile
@chriswayg
chriswayg / Ubuntu_Debian_Cloud_images_in_Proxmox.md
Last active April 11, 2025 10:35
Ubuntu and Debian Cloud images in Proxmox
# taken from http://www.piware.de/2011/01/creating-an-https-server-in-python/
# generate server.pem with the following command:
# openssl req -new -x509 -keyout key.pem -out server.pem -days 365 -nodes
# run as follows:
# python simple-https-server.py
# then in your browser, visit:
# https://localhost:4443
import http.server
@sanjay-btc
sanjay-btc / gist:c332d6f8a886853d5071f0a08051ff70
Created December 20, 2018 06:23
Install AWS Vault in Ubuntu
sudo curl -L -o /usr/local/bin/aws-vault https://github.com/99designs/aws-vault/releases/download/v4.2.0/aws-vault-linux-amd64
sudo chmod 755 /usr/local/bin/aws-vault
@lanbugs
lanbugs / paloalto_xmlapi.py
Created June 22, 2018 22:16
Palo Alto Networks XML API with python and beautifulsoup, example prints ARP table
#!/usr/bin/env python
# required pip packages: lxml, beautifulsoup4, tabulate
from bs4 import BeautifulSoup as BS
import urllib2
import ssl
import urllib
from tabulate import tabulate
@mdlavin
mdlavin / lambda-function-xray-enablement.tf
Last active July 23, 2024 14:40
Terraform configuration to enable X-Ray for a Lambda function
resource "aws_lambda_function" "service" {
# Your usual aws_lambda_function configuration settings here
tracing_config {
mode = "Active"
}
}
@anttu
anttu / secretsmanager.tf
Created May 4, 2018 16:03
Terraform AWS Secrets Manager example with key and value
resource "aws_secretsmanager_secret" "IRCSecrets" {
name = "irc/client/credentials"
description = "My IRC client credentials"
}
resource "aws_secretsmanager_secret_version" "IRCCredentials" {
secret_id = "${aws_secretsmanager_secret.IRCSecrets.id}"
secret_string = "{\"username\":\"AzureDiamond\",\"password\":\"hunter2\"}"
}
@demsey2
demsey2 / gist:c957cb6bcce39efad564ca40a266d84f
Created April 6, 2018 23:20
CloudFront Lambda security headers
// https://blog.crashtest-security.com/lambda-edge-to-configure-http-security-headers-for-cloudfront-34a44775061d
'use strict';
exports.handler = (event, context, callback) => {
const response = event.Records[0].cf.response;
const headers = response.headers;
// Add security headers
@seanhandley
seanhandley / docker-compose.yml
Last active January 23, 2025 09:49
How To Set Up Docker For Mac (Mojave) with Native NFS
version: '2'
services:
api:
volumes:
- "nfsmount:${CONTAINER_DIR}"
volumes:
nfsmount:
driver: local
driver_opts:
@metamatik
metamatik / migrate-redis.py
Last active March 25, 2020 10:41 — forked from kitwalker12/migrate-redis.py
Migrate Redis data on Amazon ElastiCache
"""
Forked and heavily adappted from:
https://gist.github.com/kitwalker12/517d99c3835975ad4d1718d28a63553e
Copies all keys from the source Redis host to the destination Redis host.
Useful to migrate Redis instances where commands like SLAVEOF and MIGRATE are
restricted (e.g. on Amazon ElastiCache).
The script scans through the keyspace of the given database number and uses
a pipeline of DUMP and RESTORE commands to migrate the keys.
@guillochon
guillochon / ssh-airplane-wifi.md
Last active April 15, 2025 16:29
Instructions on how to SSH on airplane WiFi that blocks port 22

Using SSH through airplane WiFi that blocks port 22

Many aircraft that offer wifi only permit access to machines on port 80/443, the standard http(s) ports. If you want to SSH, you have to set up an intermediate machine that hosts the SSH service on either port 80 or 443. An easy (and free) way to do this is via a Google free-tier micro instance. These instances have a 1 GB transfer ceiling per month, but so long are you are only transmitting textual data a few days per month, this limit should not be easily exceeded. Set up one of these VMs via the Google Cloud console, and select CentOS 7 as the disk image. Make sure that you allow http/https traffic on the instance, the two checkboxes in the Firewalls section of the VM settings. Optionally, set a static external IP address for your server in the VM config, in case you don't want to look up the IP each time. Then, ssh into the new VM (the IP address will be listed as the "external IP" in the list of instances) and edi