This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import BaseHTTPServer | |
from SimpleHTTPServer import SimpleHTTPRequestHandler | |
import sys | |
import base64 | |
key = "" | |
class AuthHandler(SimpleHTTPRequestHandler): | |
''' Main class to present webpages and authentication. ''' | |
def do_HEAD(self): |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
import telnetlib | |
import time | |
import os | |
HOST="some.host.com" | |
PORT=22 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
TUNNEL_PORT1=$1 | |
TUNNEL_PORT2=$2 | |
wget http://www.harding.motd.ca/autossh/autossh-1.4e.tgz | |
gunzip -c autossh-1.4e.tgz | tar xvf - | |
cd autossh-1.4e | |
./configure | |
make | |
sudo make install |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
server { | |
listen 80; | |
server_name dgmates.com dgmates.com.sg www.dgmates.com.sg dgmates.sg www.dgmates.sg; | |
return 301 http://www.dgmates.com$request_uri; | |
} | |
server { | |
server_name www.dgmates.com; | |
access_log /var/log/nginx/dgmates.access.log; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
file=id_rsa.pub | |
bucket=com.dgmates.public.bucket | |
resource="/${bucket}/${file}" | |
contentType="text/plain" | |
dateValue="$(LC_ALL=C date -u +"%a, %d %b %Y %X %z")" | |
stringToSign="PUT\n\n${contentType}\n${dateValue}\n${resource}" | |
s3Key=<AWS_ACCESS_KEY_ID> | |
s3Secret=<AWS_ACCESS_KEY_SECRET> | |
signature=`echo -en ${stringToSign} | openssl sha1 -hmac ${s3Secret} -binary | base64` | |
curl -k -X PUT -T "${file}" \ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
use re 'eval'; | |
'?' | |
=~( '(' | |
.'?'. '{'. | |
('`'| '%'). | |
('[' ^'-' | |
).''. ('`'| | |
'!') .''. | |
('`'| ','). | |
(( '"')) . ( ('[')^ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// get all links and post to console | |
var arr = [], links = document.links; | |
for(var i = 0; i < links.length; i++) { | |
arr.push(links[i].href); | |
} | |
console.log(arr.join('\n')) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import ansible.module_utils.one | |
import kitchen.text, ansible.module_utils.two, docutils, ansible.module_utils.three, distutils.sysconfig | |
import ansible.module_utils.four.parse | |
from ansible.module_utils.five import * | |
from ansible.module_utils.six import parse | |
from ansible.module_utils import seven | |
from ansible.module_utils import eight, nine | |
from ansible.module_utils.ten.foo import parse | |
b = 1 ; import ansible.module_utils.eleven |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import random | |
def main(): | |
length = int(raw_input('How long should your password be?\n')) | |
print("Here's the password I generated: " + "".join(random.sample('QWERTYUIOPASDFGHJKLZXCVBNM1234567890abcdefghijklmnopqrstuvwxyz1234567890!@#$%^&*()_+', length))) | |
main() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import boto3 | |
ec2 = boto3.client('ec2') | |
ses = boto3.client('ses') | |
def email_service(email_title, email_body): | |
fromaddr = '[email protected]' | |
toaddr = '[email protected]' | |
bcc = '[email protected]' |