This file contains 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 os | |
path = 'data' | |
os.chdir(path) | |
files = sorted(os.listdir(os.getcwd()), key=os.path.getmtime) | |
oldest = files[0] | |
newest = files[-1] |
This file contains 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
# if not re.match("^[a-z]*$", input_str): | |
import random | |
import os | |
import re | |
os.system('cls' if os.name=='nt' else 'clear') | |
while (1 < 2): | |
print "\n" | |
print "Rock, Paper, Scissors - Shoot!" |
This file contains 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
Using the nc command you can scan a port or a range of ports to verify whether a UDP port is open and able to receive traffic. | |
This first command will scan all of the UDP ports from 1 to 65535 and add the results to a text file: | |
$ nc -vnzu server.ip.address.here 1-65535 > udp-scan-results.txt | |
This merely tells you that the UDP ports are open and receive traffic. | |
Perhaps a more revealing test would be to actually transfer a file using UDP. |
This file contains 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
hiredate= '1981-06-03' | |
pattern = '%Y-%m-%d' | |
epoch = int(time.mktime(time.strptime(hiredate, pattern))) | |
print epoch | |
360388800 |
This file contains 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
# Drupal 6 NGINX Configuration File | |
# Enable www.mysite.com or mysite.com to be served | |
server { | |
server_name www.mysite.com; | |
rewrite ^/(.*) $scheme://mysite.com/$1 permanent; | |
} | |
server { | |
server_name mysite.com; | |
access_log /var/log/nginx/mysite.com-access.log; |
This file contains 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
from bottle import route, run, static_file, request, abort, redirect, view, template | |
import re | |
# Serve a static html with templates | |
# Create an index.tpl and save it in /views | |
''' | |
#Sample index.tpl | |
<html> | |
<head> | |
<link rel="stylesheet" type="text/css" href="/static/styles.css" /> |
This file contains 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
{ | |
"Description" : "RadiantBlue Drupal 7 CloudFormation template from a make file V.0.0.1", | |
"Parameters" : { | |
"KeyName" : { | |
"Description" : "Name of an existing EC2 KeyPair to enable SSH access to the instances", | |
"Type" : "String", |
This file contains 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
# This uses the grains module | |
# http://docs.saltstack.org/en/latest/ref/modules/all/salt.modules.grains.html#module-salt.modules.grains | |
# http://salt.readthedocs.org/en/latest/ref/states/all/salt.states.module.html#module-salt.states.module | |
salt: | |
module.run: | |
- name: grains.ls | |
This file contains 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
f = open('user.yaml') | |
dataMap = yaml.load(f) | |
f.close() | |
print "" | |
print "=-----------=" | |
print "dataMap is a ", type(dataMap), dataMap | |
print "=-----------=" | |
print "main items are", type(dataMap['main']), dataMap['main'] |
This file contains 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 | |
# Install elaphe first | |
# pip install elaphe | |
from elaphe.upc import UpcA | |
upc_a = UpcA() | |
# Just a simple dictionary of numbers. If I remember right, I had to use UPC A because they had the number of characters I needed |
NewerOlder