Skip to content

Instantly share code, notes, and snippets.

View gideon-maina's full-sized avatar
🎯
Focusing

GideonMaina gideon-maina

🎯
Focusing
  • Engineering today for a better tomorrow.
  • Nairobi, KE, 254
View GitHub Profile
@gideon-maina
gideon-maina / create_rangoli.py
Created April 16, 2020 14:59
Create an alphabet rangoli hacker rank challenge
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)
@gideon-maina
gideon-maina / create_door_mat.py
Last active April 14, 2020 11:44
make a door mat , challenge from hackerrank
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
@gideon-maina
gideon-maina / african_countries_iso_codes.json
Last active April 16, 2020 15:03
African Countries with iso_codes and the country_names
[
{
"iso_code" : "DZA",
"country_name" : ""
},
{
"iso_code" : "AGO",
"country_name" : "Angola"
},
{
@gideon-maina
gideon-maina / african_countries_iso_codes.txt
Created September 6, 2017 12:44
African countries ISO codes
DZA
AGO
SHN
BEN
BWA
BFA
BDI
CMR
CPV
CAF
@gideon-maina
gideon-maina / download_a_readthedocs_doc_as_pdf.sh
Last active July 22, 2017 16:58
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/
#!/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=">>: "
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 = []
@gideon-maina
gideon-maina / passwordhashing
Created November 30, 2013 20:06
A password hash generator
#! /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