This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package com.fada21.android | |
import android.graphics.Bitmap | |
import android.graphics.BitmapFactory | |
import android.graphics.Matrix | |
import androidx.exifinterface.media.ExifInterface | |
import java.io.File | |
import java.io.FileInputStream | |
import java.io.IOException |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package test | |
import io.reactivex.Observable | |
import io.reactivex.observers.TestObserver | |
import io.reactivex.rxkotlin.toObservable | |
import org.junit.Before | |
import org.junit.Test | |
class EndlessStreamWithListsToFilterKotlinTest { | |
val list1 = listOf(1, 2, 3, 4) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# gitconfig with aliases | |
cat > ~/.gitconfig << EOF | |
[alias] | |
list = !git config -l | grep alias | cut -c 7- | |
up = fetch | |
st = status | |
br = branch | |
brn = !git rev-parse --abbrev-ref HEAD | |
brd = branch -D | |
co = checkout |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
DEFAULT_API_VERSION=`cat dockerImageSha` | |
if [ ! -z $1 ] ; then echo "setting API_VERSION to $1"; else echo "API_VERSION not set, using default: $DEFAULT_API_VERSION"; fi | |
API_VERSION=${1:-$DEFAULT_API_VERSION} | |
export API_VERSION | |
echo "API_VERSION set to $API_VERSION" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# use like ./certs.sh www.google.com | |
#!/bin/bash | |
certs=`openssl s_client -servername $1 -host $1 -port 443 -showcerts </dev/null 2>/dev/null | sed -n '/Certificate chain/,/Server certificate/p'` | |
rest=$certs | |
while [[ "$rest" =~ '-----BEGIN CERTIFICATE-----' ]] | |
do | |
cert="${rest%%-----END CERTIFICATE-----*}-----END CERTIFICATE-----" | |
rest=${rest#*-----END CERTIFICATE-----} | |
echo `echo "$cert" | grep 's:' | sed 's/.*s:\(.*\)/\1/'` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
## ============================================= | |
# peek on gms service | |
adb -s emulator-5554 shell dumpsys activity service GcmService --endpoints <package> | |
## ============================================= | |
# MITM | |
MY_IP=$(ifconfig wlan0 | sed -rn 's/.*inet addr:(.+) Bcast:.*/\1/p') | |
mitmproxy -i $MY_IP -p 8888 | |
# proxy enabled emulators | |
/home/fada21/Android/Sdk/tools/emulator -netdelay none -netspeed full -avd Nexus_5X_API_23 -http-proxy localhost:8888 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def findPrimes(toInt: Int): Seq[Int] = { | |
def eras(l: Seq[Int]): Seq[Int] = { | |
val size = l.size | |
val mlist = collection.mutable.IndexedSeq(l:_*) | |
def crossout(x: Int): Unit = { | |
def crossout(xbase: Int, x: Int):Unit = { | |
if (x<size) { | |
mlist(x) = 0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# ubuntu/mint setup tips | |
# SETUP ============ | |
## ================= | |
# http://mintguide.org/tools/317-make-a-bootable-flash-drive-from-an-iso-image-on-linux-mint.html | |
# df # lists mounted devices | |
# sudo dd if=/home/USER/linuxmint.iso of=/dev/sdb | |
# watch -n5 'sudo kill -USR1 $(pgrep ^dd)' # monitoring dd progress | |
# git ppa | |
sudo add-apt-repository ppa:git-core/ppa |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
val line2nums = io.StdIn.readLine.split(" ").map(_.toInt) | |
val lines2nums = io.Source.stdin.getLines().map(_.toInt) | |
val streamOfInts = Stream.continually(io.StdIn.readInt()) | |
val fib = { | |
def f(f0:Int, f1:Int): Stream[Int] = f0 #:: f(f1, f0 + f1) | |
f(0,1) | |
} | |
//fib(18) | |
//fib.take(19).toList |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
final ViewTreeObserver viewTreeObserver = someView.getViewTreeObserver(); | |
viewTreeObserver.addOnGlobalLayoutListener(new ViewTreeObserver.OnGlobalLayoutListener() { | |
@SuppressWarnings("deprecation") | |
@SuppressLint("NewApi") | |
public void onGlobalLayout() { | |
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.JELLY_BEAN) { | |
viewTreeObserver.removeGlobalOnLayoutListener(this); | |
} else { |
NewerOlder