Skip to content

Instantly share code, notes, and snippets.

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

Deepankar Bhardwaj deepankarb

🏠
Working from home
View GitHub Profile
@deepankarb
deepankarb / transpose_csv.py
Created April 30, 2024 07:37
Transpose a single column from a CSV
# Copyright 2024, Deepankar Bhardwaj
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
@deepankarb
deepankarb / Android Studio .gitignore
Created September 18, 2017 14:53 — forked from iainconnor/Android Studio .gitignore
A .gitignore for use in Android Studio
# Built application files
/*/build/
# Crashlytics configuations
com_crashlytics_export_strings.xml
# Local configuration file (sdk path, etc)
local.properties
# Gradle generated files
@deepankarb
deepankarb / Util.java
Created September 17, 2017 04:47
java MD5
public static String md5(String in) {
byte[] bytes;
StringBuilder hashtext;
try {
bytes = in.getBytes("UTF-8");
MessageDigest md = MessageDigest.getInstance("MD5");
byte[] digest = md.digest(bytes);
BigInteger bigInt = new BigInteger(1, digest);
hashtext = new StringBuilder(bigInt.toString(16));
@deepankarb
deepankarb / TreeView.java
Created September 7, 2017 11:35
Donald Knuth's binary tree drawing algorithm.
package org.zg.koch;
import android.content.Context;
import android.graphics.Canvas;
import android.graphics.Paint;
import android.graphics.Point;
import android.support.annotation.Nullable;
import android.util.AttributeSet;
import android.view.View;
@deepankarb
deepankarb / remove-jdk.sh
Created August 31, 2017 08:59
Removes *all* JDK altgernatives.
if [ -z "$1" ]
then
echo "Please specify JDK path"
exit 1
fi
JDK_PATH="$1"
JDK_APPS=( $() )
@deepankarb
deepankarb / add-jdk.sh
Created August 31, 2017 08:58
Add an alternative JDK
if [ -z "$1" ]
then
echo "Please specify JDK path"
exit 1
fi
if [ -z "$2" ]
then
PRIORITY=100
else
@deepankarb
deepankarb / lzs.py
Created August 22, 2017 05:49 — forked from FiloSottile/lzs.py
#!/usr/bin/env python
#-*- coding:utf-8 -*-
##############################################################
# Lempel-Ziv-Stac decompression
# BitReader and RingList classes
#
# Copyright (C) 2011 Filippo Valsorda - FiloSottile
# filosottile.wiki gmail.com - www.pytux.it
#
@deepankarb
deepankarb / .bashrc
Created January 31, 2017 06:28
bashrc
#PS1
#export PS1="\[\e[01;32m\]\A\[\e[0m\]\[\e[00;37m\] \[\e[0m\]\[\e[00;34m\]\w\[\e[0m\]\[\e[00;37m\] \[\e[0m\]\[\e[00;34m\]\\$\[\e[0m\]\[\e[00;37m\] \[\e[0m\]"
export PS1="\[\e[00;34m\]\w\[\e[0m\]\[\e[00;37m\]\n\[\e[0m\]\[\e[01;32m\]\A\[\e[0m\]\[\e[00;37m\] \[\e[0m\]\[\e[00;34m\]\\$\[\e[0m\]\[\e[00;37m\] \[\e[0m\]"
# gitprompt configuration
# Set config variables first
GIT_PROMPT_ONLY_IN_REPO=1
# as last entry source the gitprompt script
source /home/"$(whoami)"/.bash-git-prompt/gitprompt.sh
@deepankarb
deepankarb / .vimrc
Last active November 6, 2017 14:27
My vim rc
execute pathogen#infect()
syntax on
filetype plugin indent on
set hlsearch
set tabstop=4
set ai
set nu
" Disable Arrow keys in Escape mode
map <up> <nop>
@deepankarb
deepankarb / loop
Created June 28, 2016 04:21
Execute runnables on the ui thread in a loop
private void loop(Deque<Runnable> rs, int delay) {
final Runnable first = rs.removeFirst();
new Handler().post(first);
rs.addLast(first);
new Handler().postDelayed(() -> loop(rs, delay), delay);
}