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 / en_SE
Created September 28, 2023 20:52 — forked from bmaupin/en_SE
en_SE locale
escape_char /
comment_char %
% This file was generated by taking the LC_TIME section from en_US and
% replacing date/time representation with that of sv_SE from the glibc
% locale sources
% (http://sourceware.org/git/?p=glibc.git;a=tree;f=localedata/locales;hb=HEAD)
% (https://www.gnu.org/software/libc/manual/html_node/Formatting-Calendar-Time.html)
% This file is part of the GNU C Library and contains locale data.
@blackknight36
blackknight36 / EmailOSXCommandLine.md
Last active December 15, 2022 00:28 — forked from roubles/EmailOSXCommandLine.md
Send email from OSX Command line using gmail as SMTP

#Step 1: Update /etc/postfix/main.cf

$ sudo vim /etc/postfix/main.cf

Add the following lines, anywhere really, but preferably under the relayhost section:

relayhost = smtp.gmail.com:587
smtp_sasl_auth_enable = yes
set nocompatible " be iMproved, required
" set the runtime path to include Vundle and initialize
set rtp+=~/.vim/bundle/Vundle.vim
call vundle#begin()
" alternatively, pass a path where Vundle should install plugins
"call vundle#begin('~/some/path/here')
" let Vundle manage Vundle, required
Plugin 'VundleVim/Vundle.vim'
#!/usr/bin/python3
import cgitb; cgitb.enable();
import requests
import string, sys, time, urllib
import xml.etree.ElementTree as et
def print_header():
print("""<html>
<head>
#!/usr/bin/python3
import requests
import string, sys, time, urllib
import xml.etree.ElementTree as et
def read_feed(url):
r = requests.get(url)
root = et.fromstring(r.text)
#!/usr/bin/python
import commands
import sys
import md5
import random
if len(sys.argv) <= 2:
print("usage: mk_ipsum.py <num> <dir>\n")
sys.exit(1)
#!/usr/bin/env python2.7
import datetime, gnupg, pytz, time
from selenium import webdriver
from selenium.webdriver import Firefox
from selenium.webdriver.firefox.options import Options
#from selenium.webdriver.common.action_chains import ActionChains
#from selenium.webdriver.common.by import By
#from selenium.webdriver.support.ui import WebDriverWait
#from selenium.webdriver.support import expected_conditions as EC
#!/usr/bin/env python
gifts = [
{'name':'partridge', 'total':0},
{'name':'turtle_doves', 'total':0},
{'name':'french_hens', 'total':0},
{'name':'calling_birds', 'total':0},
{'name':'golden_rings', 'total':0},
{'name':'geese', 'total':0},
{'name':'swans', 'total':0},
@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 = "";