Skip to content

Instantly share code, notes, and snippets.

View blackknight36's full-sized avatar
💭
I may be slow to respond.

Michael blackknight36

💭
I may be slow to respond.
View GitHub Profile
@blackknight36
blackknight36 / Load Balancing FTP.txt
Created November 30, 2020 16:56 — forked from erkie/Load Balancing FTP.txt
Load balancing FTP
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
@blackknight36
blackknight36 / gist:c7348778a0e5bdc4853df94cca09337c
Created November 19, 2020 23:32 — forked from tsnoad/gist:2642087
SSHA password hashing. this format is used by OpenLDAP to store passwords
<?
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 = "";
#!/usr/bin/python2
from string import maketrans
ciphertext = "SEHRTAGPANITMARECYCHINGOHYRWRHLIOREENESAAAIEONIXRTWTHSMTAUOTPBHIEWKBENSRBARANRINICDBSYNETCYNOTTHUAMSARHHCWIUEIRAIDIEOHNORRLAKVMVSUEFUATDHIEAATSSOSLEISNGNLEETTRASNNSGISSR"
def main():
msg = []
for i in range(1, len(ciphertext)/13):
#!/usr/bin/python2.7
import xlrd
nms = []
snow = []
loc = ('server_list.xls')
wb = xlrd.open_workbook(loc)
#!/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
#!/usr/bin/env ruby
require 'uuidtools'
uuid = UUIDTools::UUID.sha1_create(UUIDTools::UUID_OID_NAMESPACE, "0e:00:00:86:17:03")
puts(uuid)
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")
#!/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) }
pipeline {
agent any
stages{
stage('Checkout') {
steps {
git branch: '${BRANCH}', url: 'git://mdct-pagure.dartcontainer.com/puppet.git'
}
}
stage('Unit Testing') {
#!/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