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
set encoding=utf-8 | |
set nocompatible " required | |
filetype off " required | |
" set the runtime path to include Vundle and initialize | |
set rtp+=~/.vim/bundle/Vundle.vim | |
call vundle#begin() | |
" let Vundle manage Vundle, required | |
Plugin 'gmarik/Vundle.vim' |
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
# to be able to import ldap run pip install python-ldap | |
import ldap | |
if __name__ == "__main__": | |
ldap_server="x.x.x.x" | |
username = "someuser" | |
password= "somepassword" | |
# the following is the user_dn format provided by the ldap server | |
user_dn = "uid="+username+",ou=someou,dc=somedc,dc=local" |
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
def merge_lists(left_sublist,right_sublist): | |
i,j = 0,0 | |
result = [] | |
#iterate through both left and right sublist | |
while i<len(left_sublist) and j<len(right_sublist): | |
#if left value is lower than right then append it to the result | |
if left_sublist[i] <= right_sublist[j]: | |
result.append(left_sublist[i]) | |
i += 1 | |
else: |
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
import time | |
from sanic import Sanic | |
# `configure_logging=False` will stop Sanic's default logging. You'll use print() for printing to stdout | |
app = Sanic(name="MyApp", configure_logging=False) | |
@app.middleware('request') | |
async def embed_start_time(request): | |
request.ctx.start_time = time.time() # Use requst context `request.ctx` to embed extra information | |
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
# run this with python 3 | |
# no external dependencies needed | |
import random | |
# initial number of case | |
initial_case = 2 | |
# number of carrier | |
carrier = 2 | |
# number of infected |
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 pyftpdlib.authorizers import DummyAuthorizer | |
from pyftpdlib.handlers import FTPHandler | |
from pyftpdlib.servers import FTPServer | |
authorizer = DummyAuthorizer() | |
authorizer.add_user("user", "password", "/home/user", perm="elradfmw") | |
authorizer.add_anonymous("/home/nobody") | |
handler = FTPHandler | |
handler.authorizer = authorizer |
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
def quicksort(input_list): | |
higher = [] | |
lower = [] | |
if len(input_list) > 2: | |
pivot = (len(input_list) - 1)/2 | |
mid = [input_list[pivot]] | |
i = 0 | |
while i < len(input_list): | |
if i != pivot: | |
if input_list[i] <= input_list[pivot]: |
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
#create the key-value object | |
class KeyValue: | |
def __init__(self,key,value): | |
self.key=key | |
self.value=value | |
class HashTable: | |
#initiate an empty list that will store all key value pair based on the KeyValue object | |
def __init__(self): |
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
<div id="prism-widget"></div> | |
<script src="https://prismapp-files.s3.amazonaws.com/widget/prism.js"></script> | |
<script type="text/javascript"> | |
(function(e, b, c) { | |
e.Shamu = { | |
merchant_id: '', | |
initialize: function(a) { | |
a.merchant_id ? this.merchant_id = a.merchant_id : console.log("Shamu: Please initialize Shamu with a merchat_id"); | |
}, | |
display: function() { |
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 mothernature import Environment | |
env = Environment("someyml.yaml", environment='DEV') | |
test_env.get("DB_CONNECTION") |
NewerOlder