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 string | |
def next_less_even_number(n): | |
for i in range(n-1, 0, -1): | |
if i % 2 == 0: | |
return i | |
def next_greater_even_number(n, x=2): | |
return n + (x-n %x) |
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 re | |
def get_next_multiple_greater_than_n_for_x(n, x): | |
return n + (x-n %x) | |
def get_next_multiple_less_than_n_for_x(n, x): | |
for i in range(n-1, 0, -1): | |
if i % x == 0: | |
return i |
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
[ | |
{ | |
"iso_code" : "DZA", | |
"country_name" : "" | |
}, | |
{ | |
"iso_code" : "AGO", | |
"country_name" : "Angola" | |
}, | |
{ |
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
DZA | |
AGO | |
SHN | |
BEN | |
BWA | |
BFA | |
BDI | |
CMR | |
CPV | |
CAF |
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
#!/bin/bash | |
# Author : Gideon Kamau Maina <[email protected]> | |
# Date : 21-07-2017 | |
# Description : Generate a URL for downloading read the docs, | |
# docs as PDF and download the doc for you. | |
# Credits : http://natanyellin.com/2012/04/22/downloading-pdf-documentation-for-readthedocs-projects/ | |
# Constants | |
PROMPT=">>: " |
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 random | |
# Pattern Key || Number to enter | |
# 0 =====> 1 | |
# 1 =====> 2 | |
# 2 =====> 3 | |
# 3 =====> 4 | |
def match_password(pattern, entered_pas, db_password): | |
session_pass = [] |
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
#! /bin/bash | |
#Read input from the keyboard hidden | |
#The string version for the salt is hectic because even if i use the random function to assign alphanumeric characters this will result in a different salt for same password in a different Computer | |
echo "Enter the password to hash..." | |
read -s -r rawpassword | |
#If i want to use method two with the user supplied salt value | |
#echo "Enter the salt to use for the password..." | |
#read -s saltvalue |