Skip to content

Instantly share code, notes, and snippets.

View tushar-rishav's full-sized avatar
:bowtie:
How's it going?

Tushar Gautam tushar-rishav

:bowtie:
How's it going?
View GitHub Profile
@tushar-rishav
tushar-rishav / count_line.md
Created August 13, 2015 19:45
Count the total lines of code in a repo

Install cloc if not done already

  npm install -g cloc                    # https://www.npmjs.com/package/cloc
  sudo apt-get install cloc              # Debian, Ubuntu
  sudo yum install cloc                  # Red Hat, Fedora
  sudo pacman -S cloc                    # Arch
  sudo pkg install cloc                  # FreeBSD
  sudo port install cloc                 # Mac OS X with MacPorts
@tushar-rishav
tushar-rishav / algo_sig1.md
Last active September 5, 2015 17:09
Delta Algo SIG

Delta's Special Interest Group for Algorithms

Session-I

Conceptual Question:
  1. Which of the below code snippets can give stackoverflow for very large value of 'n' ( Do not consider Python while answering this question ) : I)
        function foo(n){
          if(n > 0)
            return foo(n - 1);
        }
@tushar-rishav
tushar-rishav / log_trick.py
Created October 10, 2015 13:26
smart_logging
parser.add_argument('-v', '--verbose', action='count', default=0)
parser.add_argument('-q', '--quiet', action='count', default=0)
logging_level = logging.WARN + 10*args.quiet - 10*args.verbose
# script -vv -> DEBUG
# script -v -> INFO
# script -> WARNING
# script -q -> ERROR
# script -qq -> CRITICAL
@tushar-rishav
tushar-rishav / keylog.py
Created October 22, 2015 10:32
Read keyboard system files
import os
DEF_INP = "/dev/input/"
DEF_BUS = "/proc/bus/input/devices"
def read_device():
fd = os.popen("grep -E 'Handlers|EV=' " + DEF_BUS + " | grep -B1 'EV=120013' | grep -Eo 'event[0-9]+'")
events = list(fd.read().split("\n"))[:-1]
fd.close()
return events
print(DEF_INP + read_device()[0])
@tushar-rishav
tushar-rishav / log.py
Created October 22, 2015 10:43
Create log files
import logging,inspect
def function_logger(file_level, console_level = None):
"""
Store keys
"""
function_name = inspect.stack()[1][3]
logger = logging.getLogger(function_name)
logger.setLevel(logging.DEBUG)
if console_level != None:
@tushar-rishav
tushar-rishav / eurothon.md
Last active March 5, 2016 21:38
EuroPyCon stuff

Goal

You will be guided to make a real contribution to an open source project (coala). The skills you learn are generally applicable.

Prerequisite

  1. Eager to contribute to open source.
  2. Willingness to do great things in python
  3. GitHub account
  4. Git installed
  5. A laptop
@tushar-rishav
tushar-rishav / idea.ml
Last active February 7, 2017 20:10
Cool idea involving ML
Create stuff based on user's browsing history that suggests a user to take some interesting courses online.
@tushar-rishav
tushar-rishav / strings.md
Created April 1, 2016 21:07
Guitar strings

Frequencies of the strings

frequencies = {
	'E': 329.63,
	'A': 440,
	'D': 587.33,
	'G': 783.99,
	'B': 987.77,
	'e': 1318.5
@tushar-rishav
tushar-rishav / alphonso.md
Created December 5, 2016 11:28
Implementation details

Dependencies

Faker - pip install Faker

Implementation Details

Programming language used:

Python

Files: