Skip to content

Instantly share code, notes, and snippets.

View manparvesh's full-sized avatar
:shipit:
Every day is a new day to make bad decisions!

Man Parvesh Singh Randhawa manparvesh

:shipit:
Every day is a new day to make bad decisions!
View GitHub Profile
@manparvesh
manparvesh / clean_code.md
Created April 20, 2020 18:05 — forked from wojteklu/clean_code.md
Summary of 'Clean code' by Robert C. Martin

Code is clean if it can be understood easily – by everyone on the team. Clean code can be read and enhanced by a developer other than its original author. With understandability comes readability, changeability, extensibility and maintainability.


General rules

  1. Follow standard conventions.
  2. Keep it simple stupid. Simpler is always better. Reduce complexity as much as possible.
  3. Boy scout rule. Leave the campground cleaner than you found it.
  4. Always find root cause. Always look for the root cause of a problem.

Design rules

@manparvesh
manparvesh / soot
Created October 13, 2019 23:33
Running soot static analysis tool
#!/bin/sh
# download the jar file with dependencies from soot github repo
# path to rt.jar can be different in your system and also for different java versions. I am using Java 8
java -cp ~/Downloads/sootclasses-trunk-jar-with-dependencies.jar soot.Main -cp /usr/lib/jvm/java-8-openjdk-amd64/jre/lib/rt.jar:$PWD $@
@manparvesh
manparvesh / git-cleanup.sh
Created June 2, 2019 04:51
Git remove all commits except the current one
#!/usr/bin/env bash
rm -rf .git
git init
git add .
git commit -m "Initial commit"
git remote add origin <git origin url>
git push -u --force origin <branch>
@manparvesh
manparvesh / tf-test.py
Created May 31, 2019 16:57
Testing if tensorflow is using GPU acceleration
import tensorflow as tf
# If this program does not throw any error while running, it means GPU acceleration is being used.
# If there is an error message after running this program, you need to check you graphics driver settings
with tf.device('/gpu:0'):
a = tf.constant([1.0, 2.0, 3.0, 4.0, 5.0, 6.0], shape=[2, 3], name='a')
b = tf.constant([1.0, 2.0, 3.0, 4.0, 5.0, 6.0], shape=[3, 2], name='b')
c = tf.matmul(a, b)
@manparvesh
manparvesh / code-server.sh
Created May 30, 2019 11:04
VS Code setup on AWS EC2
#!/usr/bin/env bash
# This script is to run VSCode in a remote server using code-server
# https://github.com/cdr/code-server
# get tar.gz file that contains the binary
mkdir ~/code-setup
cd ~/code-setup
CODE_SERVER_VERSION="1.1119-vsc1.33.1"
@manparvesh
manparvesh / README.md
Created May 12, 2019 17:48
Easiest deep learning setup
@manparvesh
manparvesh / battery-notifier.sh
Last active August 25, 2019 13:32
Shell file to notify when your laptop battery life is less than 20% or more than 90% as is charging
#!/bin/bash
while true
do
export DISPLAY=:0.0
battery_level=`acpi -b | grep -P -o '[0-9]+(?=%)'`
if on_ac_power; then
if [ $battery_level -ge 90 ]; then
notify-send "Battery charging above 90%. Please unplug your AC adapter!" "Charging: ${battery_level}% "
spd-say "charge full, fulll, full"
@manparvesh
manparvesh / The Technical Interview Cheat Sheet.md
Created April 6, 2017 12:17 — forked from tsiege/The Technical Interview Cheat Sheet.md
This is my technical interview cheat sheet. Feel free to fork it or do whatever you want with it. PLEASE let me know if there are any errors or if anything crucial is missing. I will add more links soon.

Studying for a Tech Interview Sucks, so Here's a Cheat Sheet to Help

This list is meant to be a both a quick guide and reference for further research into these topics. It's basically a summary of that comp sci course you never took or forgot about, so there's no way it can cover everything in depth. It also will be available as a gist on Github for everyone to edit and add to.

Data Structure Basics

###Array ####Definition:

  • Stores data elements based on an sequential, most commonly 0 based, index.
  • Based on tuples from set theory.
@manparvesh
manparvesh / interviewitems.MD
Created April 6, 2017 12:17 — forked from amaxwell01/interviewitems.MD
My answers to over 100 Google interview questions

##Google Interview Questions: Product Marketing Manager

  • Why do you want to join Google? -- Because I want to create tools for others to learn, for free. I didn't have a lot of money when growing up so I didn't get access to the same books, computers and resources that others had which caused money, I want to help ensure that others can learn on the same playing field regardless of their families wealth status or location.
  • What do you know about Google’s product and technology? -- A lot actually, I am a beta tester for numerous products, I use most of the Google tools such as: Search, Gmaill, Drive, Reader, Calendar, G+, YouTube, Web Master Tools, Keyword tools, Analytics etc.
  • If you are Product Manager for Google’s Adwords, how do you plan to market this?
  • What would you say during an AdWords or AdSense product seminar?
  • Who are Google’s competitors, and how does Google compete with them? -- Google competes on numerous fields: --- Search: Baidu, Bing, Duck Duck Go