Skip to content

Instantly share code, notes, and snippets.

View simandebvu's full-sized avatar
🖥️
Open to opportunities

Shingirayi Innocent Mandebvu simandebvu

🖥️
Open to opportunities
View GitHub Profile

Semantic Commit Messages

See how a minor change to your commit message style can make you a better programmer.

Format: <type>(<scope>): <subject>

<scope> is optional

Example

@simandebvu
simandebvu / gh-pages-deploy.md
Created August 18, 2020 09:59 — forked from cobyism/gh-pages-deploy.md
Deploy to `gh-pages` from a `dist` folder on the master branch. Useful for use with [yeoman](http://yeoman.io).

Deploying a subfolder to GitHub Pages

Sometimes you want to have a subdirectory on the master branch be the root directory of a repository’s gh-pages branch. This is useful for things like sites developed with Yeoman, or if you have a Jekyll site contained in the master branch alongside the rest of your code.

For the sake of this example, let’s pretend the subfolder containing your site is named dist.

Step 1

Remove the dist directory from the project’s .gitignore file (it’s ignored by default by Yeoman).

@simandebvu
simandebvu / README-badges.md
Created June 5, 2020 12:02 — forked from tterb/README-badges.md
A collection of README badges

Badges

License

MIT License GPLv3 License AGPL License

Version

Version GitHub Release

@simandebvu
simandebvu / lambda.rb
Created June 2, 2020 20:43
Ruby Lambda Practice
## Definition
my_lambda= lambda {|x, y| puts x*y}
my_lambda.call (12, 19)
#if no arguments we can just call as
my_lambda.call
## it can be called by using
my_lambda_filter = lambda {|x| x> 10}
[5,23,23].select(&my_lambda_filter)
@simandebvu
simandebvu / procs.rb
Created June 2, 2020 20:28
Ruby Procs Practice
peoples_ages = [25, 28, 36, 15, 17]
# Definition
## First method
my_proc = Proc.new {|n| n>30}
## Second method
my_proc_two = proc {|n| n>12 }
## They can now be reused by calling
e = peoples_ages.select(&my_proc)
@simandebvu
simandebvu / block_call.rb
Created June 2, 2020 17:23
Ruby Block Call
def my_awesome_method ("Param1", &block)
return to_enum(:each) unless block
i = 0
while i < size:
block.call at (i)
end
end
@simandebvu
simandebvu / ruby_yield.rb
Last active June 2, 2020 16:10
Ruby yield function
def white_flag
puts "First code to run !"
yield if block_given?
puts "Last Code to execute !"
end
white_flag
# "Hey guys !"
# "nice to meet you."
white_flag {p "I was the missing link !" }
@simandebvu
simandebvu / EmailAttachment.py
Created March 5, 2020 18:38
Download Emails To PDF
import email
import getpass, imaplib
import os
import sys
from email.parser import HeaderParser
import re
class EmailDownloader:
@simandebvu
simandebvu / split_list_in_ns.py
Last active April 4, 2019 03:45
Split a list in sets of whatever number that you want
def list_splitter(the_list, n):
"""Yield successive n-sized chunks from the list."""
for i in range(0, len(the_list), n):
yield the_list[i:i + n]
#Implementation
import pprint
pprint.pprint(list(list_splitter(range(10, 75), 10)))
@simandebvu
simandebvu / aes_encryption.py
Created July 22, 2018 15:09 — forked from stupidbodo/aes_encryption.py
AES Encryption Example in Python
from base64 import urlsafe_b64encode, urlsafe_b64decode
from Crypto.Cipher import AES
from Crypto import Random
BS = 16
pad = lambda s: s + (BS - len(s) % BS) * chr(BS - len(s) % BS)
unpad = lambda s: s[:-ord(s[len(s) - 1:])]
base64pad = lambda s: s + '=' * (4 - len(s) % 4)