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
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
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
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
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
#!/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
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
CREATE TABLE IF NOT EXISTS `country` ( | |
`id` int(11) NOT NULL AUTO_INCREMENT, | |
`iso` char(2) NOT NULL, | |
`name` varchar(80) NOT NULL, | |
`nicename` varchar(80) NOT NULL, | |
`iso3` char(3) DEFAULT NULL, | |
`numcode` smallint(6) DEFAULT NULL, | |
`phonecode` int(5) NOT NULL, | |
PRIMARY KEY (`id`) | |
) ENGINE=MyISAM DEFAULT CHARSET=latin1; |
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
# Requirements: | |
# | |
# aws configure: | |
# AWS_ACCESS_KEY_ID, AWS_SECRET_ACCESS_KEY, REGION | |
import os | |
import boto3 | |
import random | |
import string | |
import sys, getopt |
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
#!/bin/bash | |
IMAGES=$@ | |
echo "This will remove all your current containers and images except for:" | |
echo ${IMAGES} | |
read -p "Are you sure? [yes/NO] " -n 1 -r | |
echo # (optional) move to a new line | |
if [[ ! $REPLY =~ ^[Yy]$ ]] | |
then |