Skip to content

Instantly share code, notes, and snippets.

View bpsagar's full-sized avatar

Sagar Chakravarthy bpsagar

View GitHub Profile
@bpsagar
bpsagar / views.py
Last active December 19, 2018 05:52
Django view to verify Paypal webook
import paypalrestsdk
from django.conf import settings
from django.http import JsonResponse
from django.utils.decorators import method_decorator
from django.views.decorators.csrf import csrf_exempt
from django.views.generic import View
paypalrestsdk.configure(dict(
mode=settings.PAYPAL_MODE,
@bpsagar
bpsagar / .gitlab-ci.yml
Last active April 24, 2020 16:17
Building Electron app with Gitlab's CI
stages:
- build
build:
image: electronuserland/builder:wine
stage: build
script:
- yarn
# Linux machine can be used to build only Windows and Linux binaries
- yarn dist -wl
@bpsagar
bpsagar / .vimrc
Last active June 8, 2020 13:56
Vim configuration
syntax on
" Sane defaults
set noerrorbells
set nowrap
set nu
set ignorecase
set smartcase
set incsearch
set tabstop=4 softtabstop=4 expandtab shiftwidth=4 smartindent
@bpsagar
bpsagar / mf.py
Last active April 11, 2024 15:33
A simple script to get the price of a stock in NSE market and price of mutual funds (India)
"""
Usage:
$ import mf
$ mf.get_price('INF200K01VK1') # pass ISIN of the mutual fund
> 1126.55
"""
import os
import requests
import tempfile
@bpsagar
bpsagar / xirr.py
Created December 3, 2021 14:56
Python function to calculate XIRR
"""
This file is copied from https://github.com/dkensinger/python/blob/master/XIRR.py
which doesn't exist anymore!
"""
from datetime import date
def xirr(transactions):
"""
Calculates the Internal Rate of Return (IRR) for an irregular series of cash flows (XIRR)