Skip to content

Instantly share code, notes, and snippets.

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

Ankur Bansal krazylearner

🏠
Working from home
View GitHub Profile
@krazylearner
krazylearner / setup_jdb.md
Last active September 16, 2025 12:32
set up jdb with android

start bluestack or emulator install app on it start the app

connect adb to emulator

$ adb connect localhost:5555

get 'pid' of your app .Dont forget to run it first in emulator

@krazylearner
krazylearner / adb.md
Last active August 29, 2015 14:23
Android Debug Bridge (adb) is a versatile command line tool that lets you communicate with an emulator instance or connected Android-powered device. It is a client-server program that includes three components:

Android Debug Bridge (adb) is a command line tool that lets you communicate with an emulator instance or connected Android-powered device. It is a client-server program that includes three components:


A client, which runs on your development machine. You can invoke a client from a shell by issuing an adb command. A server, which runs as a background process on your development machine. The server manages communication between the client and the adb daemon running on an emulator or device. A daemon, which runs as a background process on each emulator or device instance. You can find the adb tool in /platform-tools/.

When you start an adb client, the client first checks whether there is an adb server process already running.

@krazylearner
krazylearner / start_jenkins
Created June 21, 2015 08:39
Script to start jenkins from windows command line
net stop jenkins
java -Dhudson.util.ProcessTree.disable=true -jar "C:\Program Files (x86)\Jenkins\jenkins.war" --httpPort=8080
@krazylearner
krazylearner / dir()_in_python
Created June 17, 2015 11:38
he built-in function dir() is used to find out which names a module defines. It returns a sorted list of strings:
>>> import sys
>>> dir(sys)
['__displayhook__', '__doc__', '__excepthook__', '__name__', '__package__',
'__stderr__', '__stdin__', '__stdout__', '_clear_type_cache',
'_current_frames', '_getframe', '_mercurial', 'api_version', 'argv',
'builtin_module_names', 'byteorder', 'call_tracing', 'callstats',
'copyright', 'displayhook', 'dont_write_bytecode', 'exc_clear', 'exc_info',
'exc_traceback', 'exc_type', 'exc_value', 'excepthook', 'exec_prefix',
'executable', 'exit', 'flags', 'float_info', 'float_repr_style',
#As your program gets longer, you may want to split it into several files for easier maintenance.
#You may also want to use a handy function that you’ve written in several programs without copying its definition into each program.
#To support this, Python has a way to put definitions in a file and use them in a script or in an interactive instance of the interpreter.
#Such a file is called a module; definitions from a module can be imported into other modules or into the main module
# Fibonacci numbers module
# fibo.py
def fib(n): # write Fibonacci series up to n
a, b = 0, 1
while b < n:
@krazylearner
krazylearner / Python_List_list()_Method
Created June 12, 2015 14:41
Python List list() Method
The method list() takes sequence types and converts them to lists. This is used to convert a given tuple into list.
aTuple = (123, 'xyz', 'zara', 'abc');
aList = list(aTuple)
print "List elements : ", aList
#When we run above program, it produces following result:
@krazylearner
krazylearner / Filesystem_structure_Python_project
Created June 11, 2015 12:08
Filesystem structure of a Python project
Do:
================
1.name the directory something related to your project. For example, if your project is named "Twisted",
name the top-level directory for its source files Twisted. When you do releases, you should include a version number suffix: Twisted-2.5.
2.create a directory Twisted/bin and put your executables there, if you have any.
Don't give them a .py extension, even if they are Python source files.
Don't put any code in them except an import of and call to a main function defined somewhere else in your projects.
(Slight wrinkle: since on Windows, the interpreter is selected by the file extension,
your Windows users actually do want the .py extension.
So, when you package for Windows, you may want to add it.
@krazylearner
krazylearner / Normalizes-HTTP-header-names
Created May 7, 2015 12:31
Normalizes HTTP header names according to RFC 2616.
/**
* A map of HTTP header names with irregular case.
* IrregularHeaderNames.js
*/
module.exports = [
'Content-ID',
'Content-MD5',
'DNT',
'ETag',
'P3P',
@krazylearner
krazylearner / javascript_Object.defineProperty
Created April 28, 2015 11:24
how to use javascript Object.defineProperty
//Since you asked a similar question, let's take it step by step.
//It's a bit longer, but it may save you much more time than I have spent on writing this:
//Property is an OOP feature designed for clean separation of client code.
//For example, in some e-shop you might have objects like this:
function Product(name,price) {
this.name = name;
this.price = price;
this.discount = 0;
@krazylearner
krazylearner / cookie generator
Last active August 29, 2015 14:20
/** * Creates a cookie string using the given options, which may be any of * the following: * * - value * - domain * - path * - expires * - secure * - httpOnly or HttpOnly */