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 android.os.Handler | |
import android.os.Looper | |
import android.util.Log | |
class HandlerRetryLooper( | |
private val runnable: Runnable | |
) { | |
private val TAG = "HandlerRetryLooper" | |
private val handler: Handler = object : Handler(Looper.getMainLooper()){} |
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
#!/bin/bash | |
# CONFIG | |
HEIGHT_LIMIT_MAX=-10 | |
SLEEP_RETRY=10m | |
# | |
IS_FIRST_LOOP=true | |
sleepIfNeed() { |
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
#!/bin/bash | |
### CONFIG ### | |
APP_LOCATION="/usr/lib/chia-blockchain/resources/app.asar.unpacked/daemon/chia" | |
############## | |
HTML=$(curl -sS https://chia.keva.app/) | |
ipRegex="[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}" | |
IPS=($(echo ${HTML} | grep -Eo "${ipRegex}")) |
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
#!/bin/bash | |
# fail if any commands fails | |
set -e | |
VERSION_NAME=$(grep "versionName" android/app/build.gradle | awk '{print $2}' | tr -d \''\"') | |
VERSION_CODE=$(grep "versionCode\s\+[0-9]\+" android/app/build.gradle | awk '{ print $2 }') | |
[[ -z "${VERSION_NAME}" ]] && echo "VERSION_NAME is empty!" && exit 1 | |
echo "Version name: $VERSION_NAME" |
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
#!/bin/bash | |
FILES=$(ls -al | grep '^-' | awk '{print $9}') | |
for file in ${FILES} | |
do | |
file_last_modified_date=$(stat --format=%y "${file}" | awk '{ print $1 }') | |
mkdir -p "${file_last_modified_date}" | |
mv -v "${file}" "${file_last_modified_date}" | |
done |
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
#!/bin/bash | |
ADB_DEVICES=($(adb devices | grep -v "List" | awk '{print $1}')) | |
for device in ${ADB_DEVICES}; do | |
adb -s "$device" $@ | |
done |
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
// Problema: tenho um array com n elementos, quero pegar um array com x elementos por vez. | |
// Ex.: tenho um array com 5531 elementos, mas quero pegar de 1000 em 1000, resultando em 6 arrays com 1000 elementos e o ultimo com 531. | |
// OBS: já verifico antes: results é diferente de 0 e results é <= count. | |
var results = ['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h']; | |
var sizeArray = results.length; | |
var count = 2; | |
var sizeLoop = sizeArray / count; |
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
// By Jamie Chapman, @chappers57 | |
// License: open, do as you wish, just don't blame me if stuff breaks ;-) | |
public class ParseProxyObject implements Serializable { | |
private static final long serialVersionUID = 1L; | |
private HashMap<String, Object> values = new HashMap<String, Object>(); | |
public HashMap<String, Object> getValues() { | |
return values; |
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
#include <stdio.h> | |
/* | |
3. Faça um programa que crie um registro de um funcionário com as seguintes informações: nome, identidade, data de nascimento e salário. | |
O programa deve inicializar a estrutura a partir de dados digitados pelo usuário e depois mostra-la na tela.Utilize subprogramas e passagem de parâmetros. | |
*/ | |
typedef struct { | |
int dia; | |
int mes; |