Skip to content

Instantly share code, notes, and snippets.

@vannenc
vannenc / EachDirectoryPath.md
Created July 25, 2016 09:42 — forked from granoeste/EachDirectoryPath.md
[Android] How to get the each directory path.

System directories

Method Result
Environment.getDataDirectory() /data
Environment.getDownloadCacheDirectory() /cache
Environment.getRootDirectory() /system

External storage directories

@vannenc
vannenc / SmoothScroll
Created December 9, 2014 07:25
ListView Smooth scroll
// SMooth Scroll without lag
listView.postDelayed(new Runnable() {
@Override
public void run() {
listView.smoothScrollToPosition(position);
}
}, 600);
@vannenc
vannenc / RoundedCorrnersBitmap
Created August 21, 2014 17:54
Make a bitmap with rounded corners
// By Sorrodos
// http://stackoverflow.com/a/5188171/984466
/**
* Use this method to scale a bitmap and give it specific rounded corners.
* @param context Context object used to ascertain display density.
* @param bitmap The original bitmap that will be scaled and have rounded corners applied to it.
* @param upperLeft Corner radius for upper left.
* @param upperRight Corner radius for upper right.
* @param lowerRight Corner radius for lower right.
* @param lowerLeft Corner radius for lower left.
@vannenc
vannenc / genymotion_root
Created December 8, 2013 11:49
Helpful virtual box commands. Includes root command for genymotion vm.
##list vms
vboxmanage list vms
##enumerate genymotion properties for vm
vboxmanage guestproperty enumerate "INSERT_VMNAME"
##set property
vboxmanage guestproperty set "INSERT_VMNAME" "INSERT_PROPERTYNAME" "VALUE"
##rooted genymotion by default (No superuser)
/**
* Creates a 'ghost' bitmap version of the given source drawable (ideally a BitmapDrawable).
* In the ghost bitmap, the RGB values take on the values from the 'color' argument, while
* the alpha values are derived from the source's grayscaled RGB values. The effect is that
* you can see through darker parts of the source bitmap, while lighter parts show up as
* the given color. The 'invert' argument inverts the computation of alpha values, and looks
* best when the given color is a dark.
*/
private Bitmap createGhostIcon(Drawable src, int color, boolean invert) {
int width = src.getIntrinsicWidth();
@vannenc
vannenc / clean.py
Last active December 17, 2015 13:59
Delete empty directories. I use this script to clean up my music folder from empty directories and directories which only contain a music artwork.
import os
from os.path import join
def remEmptyDir(mypath):
ignore_files = ['Folder.jpg', 'albumart.pamp']
for root, dirs, files in os.walk(mypath, topdown=False):
for name in dirs:
fname = join(root, name)
from fabric.api import *
import os
import fabric.contrib.project as project
# Local path configuration (can be absolute or relative to fabfile)
env.theme = 'themes/your-theme'
env.deploy_path = '/absolute/path/for/generated/output'
# Remote server configuration
prod = 'username@server.example.com:22'
#!/bin/bash
#
# DESCRIPTION:
#
# Set the bash prompt according to:
# * the active virtualenv
# * the branch/status of the current git repository
# * the return value of the previous command
# * the fact you just came from Windows and are used to having newlines in
# your prompts.
@vannenc
vannenc / bash_prompt.sh
Last active December 10, 2015 13:48 — forked from insin/bash_prompt.sh
# .bashrc
# Source global definitions
if [ -f /etc/bashrc ]; then
. /etc/bashrc
fi
# User specific aliases and functions
pyserver() {