Skip to content

Instantly share code, notes, and snippets.

"""
Convery JSON files to YAML
depends on pyyaml, pip install pyyaml
"""
import sys
import json
from os import listdir, rename
from os.path import isdir, join, isfile, splitext
import yaml
@itzikBraun
itzikBraun / README.md
Last active July 14, 2017 15:49
SublimeText+Mitmproxy

Mitmproxy+SublimeText=Great Success

Setup

add the following lines to your bash_profile or zsh_rc or your equivelent terminal startup file.

export SUBLIME_PATH="path/to/your/subl"
export EDITOR=/path/to/sublw.sh
# pass an int as the index of the wanted devices as first parameter
# i.e adb-id.sh 1
# pass -f so the text copied to clipboard will be pre-fixed with adb -s
# It is possible to combine both parameters, i.e adb-id.sh 1 -f
IDS=$(adb devices | grep "[0-9]" | tr -s "\t " " " | cut -d " " -f 1)
# If $1 is a number we use it instead of reading.
re='^[0-9]+$'
#!/usr/bin/env bash
echo "Enter counrty code"
read country_code
echo "Enter language code"
read language_code
adb shell "setprop persist.sys.language $language_code ; setprop persist.sys.country $country_code ; stop; sleep 5; start; "
@itzikBraun
itzikBraun / ArtworkRequestHandler.java
Last active August 29, 2015 14:24
RequestHandlers for Picasso. Blog post about RequestHandlers: http://lucasr.org/2014/09/23/new-features-in-picasso/
import android.media.MediaMetadataRetriever;
import com.squareup.picasso.Picasso;
import com.squareup.picasso.Request;
import com.squareup.picasso.RequestHandler;
import java.io.ByteArrayInputStream;
import java.io.IOException;
import java.io.InputStream;
/**
* Constructing a bitmap that contains the given bitmaps(max is three).
*
* For given two bitmaps the result will be a half and half bitmap.
*
* For given three the result will be a half of the first bitmap and the second
* half will be shared equally by the two others.
*
* @param bitmaps Array of bitmaps to use for the final image.
* @param width width of the final image, A positive number.