Skip to content

Instantly share code, notes, and snippets.

View girisagar46's full-sized avatar
🇯🇵
🚀️

Sagar Giri girisagar46

🇯🇵
🚀️
View GitHub Profile
@girisagar46
girisagar46 / docx_mailmerge.py
Created October 11, 2017 09:44 — forked from vdavez/docx_mailmerge.py
A way to mailmerge Word documents using Python
#!/usr/bin/env python
import zipfile
import string
from lxml import etree
def read_docx(filepath):
# todo: Add test to make sure it's a docx
zfile = zipfile.ZipFile(filepath)
# return the xml
@girisagar46
girisagar46 / otp.py
Created March 13, 2018 18:08 — forked from rcoh/otp.py
An implementation of Google Authenticator Compatible 2-factor Codes
"""
An implementation of TOTP as described in https://tools.ietf.org/html/rfc6238#section-4 aka Google Authenticator Style 2-factor Auth
"""
import base64
import datetime
import hashlib
import hmac
import sys
import struct
import time
from typing import Tuple, NamedTuple, List, Optional, Dict
class SpendResult(NamedTuple):
is_successful: bool
remaining_balance: int
class Bank(object):
@girisagar46
girisagar46 / README.md
Created September 20, 2018 09:30 — forked from leonardofed/README.md
A curated list of AWS resources to prepare for the AWS Certifications


A curated list of AWS resources to prepare for the AWS Certifications

A curated list of awesome AWS resources you need to prepare for the all 5 AWS Certifications. This gist will include: open source repos, blogs & blogposts, ebooks, PDF, whitepapers, video courses, free lecture, slides, sample test and many other resources.


class Car{
private Wheels wheel;
private Battery battery;
/*Somewhere in our codebase we instatiate the objects required by this class.
There are two methods for implementing DI:
1. Constructor based
2. Setter based
*/
@girisagar46
girisagar46 / commit_message_example.md
Created March 18, 2019 03:23 — forked from mono0926/commit_message_example.md
[転載] gitにおけるコミットログ/メッセージ例文集100
@girisagar46
girisagar46 / gist:607f1dc49e92d529a5e3f562aaa22006
Created May 8, 2019 07:09 — forked from simonw/gist:7000493
How to use custom Python JSON serializers and deserializers to automatically roundtrip complex types.
import json, datetime
class RoundTripEncoder(json.JSONEncoder):
DATE_FORMAT = "%Y-%m-%d"
TIME_FORMAT = "%H:%M:%S"
def default(self, obj):
if isinstance(obj, datetime.datetime):
return {
"_type": "datetime",
"value": obj.strftime("%s %s" % (
// create a bookmark and use this code as the URL, you can now toggle the css on/off
// thanks+credit: https://dev.to/gajus/my-favorite-css-hack-32g3
javascript: (function() {
var elements = document.body.getElementsByTagName('*');
var items = [];
for (var i = 0; i < elements.length; i++) {
if (elements[i].innerHTML.indexOf('* { background:#000!important;color:#0f0!important;outline:solid #f00 1px!important; background-color: rgba(255,0,0,.2) !important; }') != -1) {
items.push(elements[i]);
}
}
@girisagar46
girisagar46 / GitHub-Forking.md
Created September 19, 2019 02:29 — forked from Chaser324/GitHub-Forking.md
GitHub Standard Fork & Pull Request Workflow

Whether you're trying to give back to the open source community or collaborating on your own projects, knowing how to properly fork and generate pull requests is essential. Unfortunately, it's quite easy to make mistakes or not know what you should do when you're initially learning the process. I know that I certainly had considerable initial trouble with it, and I found a lot of the information on GitHub and around the internet to be rather piecemeal and incomplete - part of the process described here, another there, common hangups in a different place, and so on.

In an attempt to coallate this information for myself and others, this short tutorial is what I've found to be fairly standard procedure for creating a fork, doing your work, issuing a pull request, and merging that pull request back into the original project.

Creating a Fork

Just head over to the GitHub page and click the "Fork" button. It's just that simple. Once you've done that, you can use your favorite git client to clone your repo or j