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
Load Balancing FTP. | |
If you run an FTP server at scale, you will eventually want to load balance it. This is no mean task as FTP is a notoriously finicky protocol. Those familiar with FTP will know that it uses more than one TCP connection; the first connection is the command channel and the second is the data channel. To successfully load balance FTP, you must address both of these connections. | |
To further complicate matters, the data channel can be established using two methods. FTP Active or FTP Passive. For the rest of this document, I will simply use the terms active and passive to refer to these modes. First, let’s review how the command and data channels are used in FTP. | |
Active FTP. | |
When using FTP in active mode, the FTP client first connects to the server on port 21. This opens the command channel. The client authenticates itself, sets options, retrieves feature support from the server etc. The data channel is not opened until the client makes request that will result in the transfer of data from the |
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
<? | |
function make_salt($salt_size=32) { | |
//list of possible characters from which to cerate the salt | |
$sea = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789"; | |
//how many possible characters are there | |
$sea_size = strlen($sea); | |
$salt = ""; |
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/python2 | |
from string import maketrans | |
ciphertext = "SEHRTAGPANITMARECYCHINGOHYRWRHLIOREENESAAAIEONIXRTWTHSMTAUOTPBHIEWKBENSRBARANRINICDBSYNETCYNOTTHUAMSARHHCWIUEIRAIDIEOHNORRLAKVMVSUEFUATDHIEAATSSOSLEISNGNLEETTRASNNSGISSR" | |
def main(): | |
msg = [] | |
for i in range(1, len(ciphertext)/13): |
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/python2.7 | |
import xlrd | |
nms = [] | |
snow = [] | |
loc = ('server_list.xls') | |
wb = xlrd.open_workbook(loc) |
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 ruby | |
def check_server(url) | |
@output = %x(httping -c 1 -s -l -m #{url}).split() | |
return @output[-1].to_i | |
end | |
status = check_server('https://www.watters.ws/405.html') | |
puts "server down" if status != 200 |
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 ruby | |
require 'uuidtools' | |
uuid = UUIDTools::UUID.sha1_create(UUIDTools::UUID_OID_NAMESPACE, "0e:00:00:86:17:03") | |
puts(uuid) |
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
if $facts['operatingsystemmajrelease'] in String(range('7', '8')) { | |
notice ("This host is running CentOS $::operatingsystemrelease") | |
} | |
if $facts['operatingsystemrelease'] in String(range('20', '29')) { | |
notice ("This host is running Fedora $::operatingsystemrelease") | |
} | |
if $facts['operatingsystemrelease'] in ['20', '21', '22', '23', '24', '25'] { | |
notice ("This host is running Fedora $::operatingsystemrelease") |
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 ruby | |
require 'digest' | |
def hex_to_int(s) | |
return s.to_i(16) | |
end | |
mac = "b0:26:28:4f:e7:ef".split(':').map { |h| hex_to_int(h) } |
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
pipeline { | |
agent any | |
stages{ | |
stage('Checkout') { | |
steps { | |
git branch: '${BRANCH}', url: 'git://mdct-pagure.dartcontainer.com/puppet.git' | |
} | |
} | |
stage('Unit Testing') { |
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/ruby | |
count = 0 | |
File.foreach('six_letters.txt') do |line| | |
line.downcase! | |
letters = line.split(%r{\s*}) | |
values = letters.map do |letter| | |
# This converts the ascii value of the character to match the English alphabet | |
# See http://www.asciitable.com for details | |
letter.ord - 96 |