Skip to content

Instantly share code, notes, and snippets.

# taken from http://www.piware.de/2011/01/creating-an-https-server-in-python/
# generate server.xml with the following command:
# openssl req -new -x509 -keyout server.pem -out server.pem -days 365 -nodes
# run as follows:
# python simple-https-server.py
# then in your browser, visit:
# https://localhost:4443
import BaseHTTPServer, SimpleHTTPServer
import ssl
@alanwill
alanwill / aws-cfn-self-referencing-sg.json
Last active January 18, 2024 17:00
AWS CloudFormation example that allows a security group rule to reference the same security group as the source.
{
"Description": "Create a VPC with a SG which references itself",
"AWSTemplateFormatVersion": "2010-09-09",
"Resources": {
"vpctester": {
"Type": "AWS::EC2::VPC",
"Properties": {
"CidrBlock": "172.16.0.0/23",
"EnableDnsSupport": false,
"EnableDnsHostnames": false,
@VladSem
VladSem / tmux2_raspberry.sh
Created May 23, 2015 05:43
install tmux 2.0 on Raspberry Pi (Debian 7.8) Raspbian Wheezy
#!/bin/bash
wget "https://github.com/downloads/libevent/libevent/libevent-2.0.21-stable.tar.gz"
tar -xf libevent-2.0.21-stable.tar.gz
cd libevent-2.0.21-stable
./configure
make
make verify
sudo make install
sudo ldconfig
anonymous
anonymous / download.sh
Created June 10, 2016 19:09
Curl custom recursive download example
# Was searching for a certain lyric, couldn't find a site that allowed you to search all of a specific artists lyrics
# thanks to http://apple.stackexchange.com/a/100576
curl -O -H "User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/51.0.2704.84 Safari/537.36" http://www.azlyrics.com/19/50cent.html
for file in $(cat 50cent.html | grep href | sed 's/.*href="//' | sed 's/".*//' | grep '50cent' | grep '\.\.' | sed 's/\.\./www.azlyrics.com/'); do curl -O -H "User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/51.0.2704.84 Safari/537.36" $file ; done
grep -nir --color=always watch | less -r
# seems ip got banned after 50 or so requests so maybe need to add some delays