Skip to content

Instantly share code, notes, and snippets.

View sumanth232's full-sized avatar

Sumanth Bandi sumanth232

View GitHub Profile
@sumanth232
sumanth232 / quantconnect_lean.ipynb
Created April 27, 2020 03:06 — forked from ahmedengu/quantconnect_lean.ipynb
Installing and running quantconnect lean on google colab ubuntu 18 python version
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@sumanth232
sumanth232 / email.py
Last active September 16, 2019 23:32
Email address permutations
import sys
import os
usage_message = '''
Usage :
python email.py company 'firstname1 lastname1' 'firstname2 lastname2' ....
'''
def get_email_address_permutations(first_name, last_name, company):
first_name = first_name.lower()
@sumanth232
sumanth232 / Atom.py
Last active April 8, 2016 17:44
BioPhysics Atom Class file
import math
class Atom:
def __init__(self,line):
self.pdb_line=line
self.number=int(line[6:11])
self.name=line[12:16].strip()
self.residue_name=line[17:20].strip()
@sumanth232
sumanth232 / gdb.rb
Last active December 16, 2015 08:34 — forked from ymyzk/gdb.rb
Homebrew formula of GDB with patch for OS X Yosemite. Only gdb 7.7 version works fine on OS X without any errors.
require "formula"
class UniversalBrewedPython < Requirement
satisfy { archs_for_command("python").universal? }
def message; <<-EOS.undent
A build of GDB using a brewed Python was requested, but Python is not
a universal build.
GDB requires Python to be built as a universal binary or it will fail
@sumanth232
sumanth232 / stdc++.h
Created November 21, 2015 11:07 — forked from velicast/stdc++.h
Linux GCC 4.8.0 /bits/stdc++.h header definition.
// C++ includes used for precompiling -*- C++ -*-
// Copyright (C) 2003-2013 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
// terms of the GNU General Public License as published by the
// Free Software Foundation; either version 3, or (at your option)
// any later version.
@sumanth232
sumanth232 / partition.cpp
Last active November 1, 2015 16:12
A simple clean code for partitioning an array
/* Partition an array with 0s and 1s */
void partition(int* v, int n) {
int i=0, k=n;
while(i<k) {
if(v[i] == 0) i++;
else swap(v[i], v[--k]);
}
}
/* Partition step in Quicksort algorithm */
@sumanth232
sumanth232 / iterator.txt
Last active October 30, 2015 11:07
Invalidation of iterators after modifying containers
As we are not experts on STL iterators, Never ever modify (insert or remove something) in a data structure when you are traversing a STL container (with iterators). YOU DONT WANT TO WASTE TIME DEBUGGING
We don't want to go into the implementation details about invalidating iterators of various containers in different standards of C++ (03, 11 and more in future)
To just give you a rough idea, to simply put it... as a beginner, let us just remember as - 'Iterator of the modified STL container becomes invalidated - means it becomes invalid, erroneous'.
Actually, it doesn't occur in all cases of modification.
To be more technical and precise :
As per the standard : for STL set
The insert members shall not affect the validity of iterators and references to the container, and the erase members shall invalidate only iterators and references to the erased elements.
@sumanth232
sumanth232 / asgn5.cpp
Created March 29, 2015 17:22
Comp Geo Asgn-5
// copy here
@sumanth232
sumanth232 / commands.txt
Created February 11, 2015 17:40
Some command used in my BTP
Importing a file into my local phpmyadmin
sumanth@harekrsna:~$ mysql --local-infile -h localhost -u root -p project
Enter password: asd
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 262
Server version: 5.5.40-0ubuntu0.14.04.1 (Ubuntu)
Copyright (c) 2000, 2014, Oracle and/or its affiliates. All rights reserved.
@sumanth232
sumanth232 / kmp.c
Last active August 29, 2015 14:11
KMP algorithm implementation in the most clean shortest way
/*developed from the pseudo code from cormen page - 926
easy picturied intuition can be seen at
http://www.inf.fh-flensburg.de/lang/algorithmen/pattern/kmpen.htm */
#include<stdio.h>
#include<stdlib.h>
#include<string.h>