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
#!/usr/bin/env bash | |
if ([ -z "$1" ]); then | |
echo " | |
Usage: | |
sh delete_dotfiles.sh /path/to/your/directory | |
"; | |
exit 1; | |
fi |
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
fun Long.factorizeRec(factor: Int = 2): IntArray = when { | |
this <= 1 -> intArrayOf() | |
this % factor == 0L -> intArrayOf(factor) + (this / factor).factorizeRec(factor) | |
else -> factorizeRec(if (factor == 2) 3 else factor + 2) | |
} |
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.moonlab.unfold; | |
import android.support.annotation.NonNull; | |
import org.json.JSONException; | |
import org.json.JSONObject; | |
import org.junit.Assert; | |
import org.junit.Test; | |
import java.util.Objects; |
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
#!/usr/bin/env bash | |
if ([ -z "$1" ] || [ -z "$2" ] || [ -z "$3" ]); then | |
echo " | |
Usage: | |
sh ./path/to/pdf-invoices ./path/to/signature.png ./output | |
Note: | |
Please mind the leading slashes, there should not be any! | |
"; |
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
import sys | |
import re | |
from functools import reduce | |
def lines_of(file_name): | |
with open(file_name) as f: | |
content = f.readlines() | |
return [x.rstrip() for x in content] |
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
#!/usr/bin/env bash | |
find ~/Library -type d -name "*$1*" -print 2>/dev/null |
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
#!/usr/bin/env bash | |
([ -z "$1" ] || [ -z "$2" ]) && echo "Usage:\n sh ./pull.sh com.package.name databaseName.db" | |
adb shell "run-as $1 chmod 666 /data/data/$1/databases/$2" | |
adb exec-out run-as "$1" cat databases/"$2" > ~/"$2" | |
adb shell "run-as $1 chmod 600 /data/data/$1/databases/$2" | |
echo "Done, go check ~/$2" |
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
import java.util.* | |
fun main(args: Array<String>) { | |
val sc = Scanner(System.`in`) | |
val line = sc.nextLine() | |
val arr = line.map { it.toInt() }.toIntArray() | |
val n = arr.size | |
var a = 0 | |
var count = 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
import java.util.* | |
fun main(args: Array<String>) { | |
val sc = Scanner(System.`in`) | |
val n = sc.nextInt() | |
val k = sc.nextInt() | |
val temperatures = IntArray(n) | |
for (i in 0 until n) { | |
val x = sc.nextInt() |
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
interface DisjointSetUnion { | |
fun makeSet(node: String) | |
fun findSet(node: String): String | |
fun unionSets(left: String, right: String) | |
} |
NewerOlder