Skip to content

Instantly share code, notes, and snippets.

Avatar
🏠
Working from home

Josias Sena JosiasSena

🏠
Working from home
View GitHub Profile
@JosiasSena
JosiasSena / RotateImage.kt
Last active Jul 12, 2018
Rotate an image/bitmap
View RotateImage.kt
import android.graphics.Bitmap
import android.graphics.Matrix
import android.support.media.ExifInterface
import java.io.File
class ImageUtils {
companion object {
/**
View PhoneBookManager.java
public class PhoneBookManager {
private final ContentResolver contentResolver;
public PhoneBookManager(final Context context) {
contentResolver = context.getContentResolver();
}
private boolean isContactWithNumberExists(@NonNull final String number) {
@JosiasSena
JosiasSena / AndroidManifest.xml
Created Mar 10, 2017
Job Scheduler Code sample
View AndroidManifest.xml
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.josiassena.jobscheduler">
<uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED"/>
<application
android:allowBackup="true"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
View AndroidManifest.xml
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.packagename">
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.READ_SYNC_SETTINGS" />
<uses-permission android:name="android.permission.WRITE_SYNC_SETTINGS" />
<uses-permission android:name="android.permission.AUTHENTICATE_ACCOUNTS" />
<application
View hidesuspended.js
// ==UserScript==
// @name Hide suspended apps
// @namespace josiassena.com
// @version 1.0
// @description Hide suspended applications
// @author Josias Sena
// @match https://play.google.com/apps/publish/?dev_acc=*
// @require http://code.jquery.com/jquery-latest.js
// @grant none
// ==/UserScript==
@JosiasSena
JosiasSena / DeCryptor.java
Last active Aug 3, 2021
Encryptor and Decryptor for data encryption.decryption using the Android KeyStore.
View DeCryptor.java
/**
_____ _____ _
| __ \ / ____| | |
| | | | ___| | _ __ _ _ _ __ | |_ ___ _ __
| | | |/ _ \ | | '__| | | | '_ \| __/ _ \| '__|
| |__| | __/ |____| | | |_| | |_) | || (_) | |
|_____/ \___|\_____|_| \__, | .__/ \__\___/|_|
__/ | |
|___/|_|
*/
View WifiConnectionReceiver.java
import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.content.IntentFilter;
import android.net.wifi.WifiConfiguration;
import android.net.wifi.WifiManager;
import android.support.annotation.NonNull;
import android.util.Log;
import static android.content.ContentValues.TAG;
@JosiasSena
JosiasSena / Utils.java
Created Dec 20, 2016
Helpful utility class
View Utils.java
package josiassena.humbug;
import android.Manifest;
import android.app.Activity;
import android.app.NotificationManager;
import android.content.ClipData;
import android.content.ClipboardManager;
import android.content.Context;
import android.content.DialogInterface;
import android.content.Intent;
@JosiasSena
JosiasSena / get_supported_android_devices.js
Last active Dec 7, 2016
get supported devices from developer portal
View get_supported_android_devices.js
$(document).ready(function () {
var interval = setInterval(function () {
myTimer();
}, 5000);
function myTimer() {
var manufacturers = [];
var devices = [];
var elements = document.getElementsByTagName("li");
@JosiasSena
JosiasSena / rando_btn_rgb.py
Last active Oct 2, 2016
Raspberry Pi - Display red, green, or blue randomly on button press
View rando_btn_rgb.py
import random
import time
import RPi.GPIO as GPIO
# Constants
RUNNING = True
SLEEP_TIME = .2 # in seconds
FREQUENCY_ON = 100 # Hz
FREQUENCY_OFF = 0 # Hz