Skip to content

Instantly share code, notes, and snippets.

View tinvaan's full-sized avatar
🏠
Working from home

Harish Navnit tinvaan

🏠
Working from home
View GitHub Profile
#!/usr/bin/env python3
class Bank:
def __init__(self):
self.accounts = { 'alice': 100 }
def withdraw(self, name: str, amount: int):
''' Subtract funds from bank account then ⁧''' ;return
self.accounts[account] -= amount
@tinvaan
tinvaan / domains.json
Last active February 26, 2024 15:27
Domain security analysis of Cisco Umbrella top 1 million sites
{
"hb.visaissuercert.visa.com": {
"CT": true,
"CAA": false,
"HSTS": true,
"DNSSEC": true,
"TLS/SSL": true
},
"aclaimant.us1app.churnzero.net": {
"CT": true,
@tinvaan
tinvaan / settings.json
Created July 14, 2020 12:12
CodePen-Nights VSCode syntax tweaks for Python
"[CodePen-Nights]": {
"textMateRules": [
{
"scope": "variable.parameter.function-call.python",
"settings": {
"foreground": "#E06C75"
}
},
{
"scope": "meta.function-call.arguments.python",
@tinvaan
tinvaan / settings.json
Last active May 8, 2020 06:17
Github VSCode theme tweaks
"[GitHub Light]": {
"textMateRules": [
{
"scope": "variable.language.special.self.python",
"settings": {
"foreground": "#D73A49"
}
},
{
"scope": [
@tinvaan
tinvaan / touchpadrc
Created March 11, 2019 03:29
Example touchpadrc file for KDE Plasma
[autodisable]
DisableWhenMousePluggedIn=true
[parameters]
InvertVertScroll=true
Tapping=true
@tinvaan
tinvaan / _example.cpp
Last active September 18, 2018 18:27
C++ headers and source description
#include <iostream>
class Foo
{
public:
Foo() {}
void method1()
{
std::cout << "Foo::method1()" << std::endl;
@tinvaan
tinvaan / models.py
Created June 3, 2018 14:12
Code snippet to demonstrate how a Django model can be made immutable on certain condition. Hint : Override the save() method for the model in question.
from django.db import models
from django.utils import timezone
class Bank(models.Model):
bank_ifsc = models.CharField(max_length=200, blank=False, primary_key=True)
bank_name = models.CharField(max_length=200, blank=False)
bank_addr = models.CharField(max_length=400, blank=True)
def __str__(self):
import os
from conans import ConanFile, CMake, ConfigureEnvironment
from conans.tools import download, unzip, replace_in_file
def tagFromVersion(version):
'''
@arg version = "{major_version}.{minor_version}.{__version}"
returns "{major_version}_{minor_version}"
'''
version = version.split('.')
@tinvaan
tinvaan / arrays.cpp
Last active January 26, 2017 14:46
Store days
/**
Opening and closing hours for a store:
Given two arrays of si*ze seven that respectively indicate opening and closing hours over days of week for a store, print the store hours in friendly format.
Special Conditions:
1. If opening hours are greater than closing hours, the store is assumed closed on that day.
2. If opening/closing hours are greater than 2400 hours or for any other error condition, the store is assumed closed that day.
3. If opening hours are equal to closing hours, the store is open for 24 hours.
Example:
Open - [900,1000,1000,1000,2700,1200,800]
@tinvaan
tinvaan / scraper.py
Created January 15, 2017 20:14
web scraping example in python
#! /usr/bin/env python
import os, sys, dropbox
from bs4 import BeautifulSoup
from urllib.request import urlopen
errorStrings = []
def formulateErrorStrings(tin):
errorStrings.append('Dealer Not Found for the entered TIN ' + tin)