Skip to content

Instantly share code, notes, and snippets.

View robertoestivill's full-sized avatar

Roberto Estivill robertoestivill

View GitHub Profile
@erdemtopak
erdemtopak / extend_trial.sh
Created December 17, 2019 10:35
Extend Trial
#!/bin/sh
rm ~/Library/Preferences/GoLand2019*/eval/*evaluation.key
# The one below not required right not but keep in mind
# rm ~/Library/Preferences/GoLand2019*/options/options.xml
@1zaman
1zaman / OkHttpDelegator.java
Last active March 2, 2021 20:31
Delegator class to use as the HTTP stack layer for Volley and Retrofit, that enables some features that are not supported in OkHttp's API: 1) Disabling retries on non-idempotent methods (see https://github.com/square/okhttp/issues/1043). 2) Automatically serving the response from the cache when offline (see https://github.com/square/okhttp/issue…
package com.example.android;
import android.content.ComponentCallbacks2;
import android.content.Context;
import android.content.res.Configuration;
import android.os.StatFs;
import android.support.annotation.NonNull;
import com.android.volley.AuthFailureError;
import com.android.volley.Request;
@rharter
rharter / Scoped.kt
Last active August 9, 2022 14:58
A kotlin property delegate to scope any object to an android lifecycle. Blog post at https://ryanharter.com/blog/easy-android-scopes/
import androidx.lifecycle.get
import androidx.lifecycle.ViewModel
import androidx.lifecycle.ViewModelProvider
import androidx.lifecycle.ViewModelStore
import androidx.lifecycle.ViewModelStoreOwner
/**
* Returns a property delegate to access the wrapped value, which will be retained for the
* duration of the lifecycle of this [ViewModelStoreOwner].
*
@joinAero
joinAero / TransparentStatusBarActivity.java
Last active September 24, 2022 13:24
Android - Completely transparent status bar.
package cc.cubone.turbo.ui.demo;
import android.content.Context;
import android.graphics.Color;
import android.os.Build;
import android.os.Bundle;
import android.os.PersistableBundle;
import android.support.annotation.ColorInt;
import android.support.v4.view.GravityCompat;
import android.support.v4.widget.DrawerLayout;
@elsnosrap
elsnosrap / adb-wrapper.sh
Created May 17, 2014 19:19
A useful shell script that wraps Android adb commands when multiple devices or emulators are connected. The script will prompt for a device or emulator to run the command against, if it detects multiple devices / emulators.
#!/bin/bash
# This is a wrapper for adb. If there are multiple devices / emulators, this script will prompt for which device to use
# Then it'll pass whatever commands to that specific device or emulator.
# Run adb devices once, in event adb hasn't been started yet
BLAH=$(adb devices)
# Grab the IDs of all the connected devices / emulators
IDS=($(adb devices | sed '1,1d' | sed '$d' | cut -f 1 | sort))
@cyrilmottier
cyrilmottier / AndroidManifest.xml
Last active January 30, 2023 00:04
Android example of how to add a custom logo to the ActionBar and ensure the best possible matching starting Window.
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.cyrilmottier.android.anapp">
<!-- ... -->
<application
android:icon="@drawable/ic_launcher"
android:label="@string/config_app_name"
android:theme="@style/Theme.AnApp" >
@amaksoft
amaksoft / CompoundDrawableClickListener.java
Last active May 31, 2023 10:06
Handling TextView compound drawables touch and click events
/*
* Copyright 2017, Andrey Makeev
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
@corvax19
corvax19 / openssh-encrypt-decrypt.txt
Last active July 28, 2023 14:10
[/linux/openSSL] Simple text #encryption/#decryption with #openssl
echo -n "That's the text"|openssl enc -e -aes-256-cbc -a
Encrypt with interactive password. Encrypted message is base64-encoded afterwards.
echo -n "That's the text"|openssl enc -e -aes-256-cbc -a -k "MySuperPassword"
Encrypt with specified password. Encrypted message is base64-encoded afterwards.
echo "GVkYiq1b4M/8ZansBC3Jwx/UtGZzlxJPpygyC"|openssl base64 -d|openssl enc -d -aes-256-cbc
Base-64 decode and decrypt message with interactive password.
echo "GVkYiq1b4M/8ZansBC3Jwx/UtGZzlxJPpygyC"|openssl base64 -d|openssl enc -d -aes-256-cbc -k "MySuperPassword"
@tekemperor
tekemperor / rpi3-bt-keyboard.txt
Created July 22, 2016 01:46
Connect Apple Wireless Keyboard to Raspberry Pi 3 in Raspbian
sudo service bluetooth status # Verify bluetooth is active.
sudo bluetoothctl # Lauch bluetooth subshell.
agent on # [No idea what this does.]
default-agent # [No idea what this does.]
scan on # Displays a list of available devices.
pair XX:XX:XX:XX:XX:XX # This prepares a potential connection, the X's represent your device ID
# A "PIN code" will be displayed, type it on the keyboard and press "enter".
trust XX:XX:XX:XX:XX:XX # Adds device to trusted devices, this survives reboot.
connect XX:XX:XX:XX:XX:XX # Connect to the device now.
exit # Return to previous shell.