Skip to content

Instantly share code, notes, and snippets.

View android10's full-sized avatar
👇
fernandocejas.com

Fernando Cejas android10

👇
fernandocejas.com
View GitHub Profile
@android10
android10 / AndroidApplication.java
Created July 20, 2016 09:56
Android: how to know if your app is completely hidden
public class AndroidApplication extends MultiDexApplication {
public static final String TAG = AndroidApplication.class.getSimpleName();
@Override
public void onCreate() {
super.onCreate();
registerComponentCallbacks(new ComponentCallback());
}
private class ComponentCallback implements ComponentCallbacks2 {
@android10
android10 / build.gradle
Created September 7, 2017 16:31
Execute Script from Gradle Task - Firebase TestLab Example
// Firebase TestLab Example using Flank
task assembleAppApkForFirebase(dependsOn: ':app:assembleDebug')
task assembleTestApkForFirebase(dependsOn: ':app:assembleDebugAndroidTest')
task runAcceptanceTestsOnFirebase(type: Exec, dependsOn: ['assembleAppApkForFirebase', 'assembleTestApkForFirebase']) {
description 'Assembles App and Test apks for execution on Firebase Test Lab.'
workingDir "$rootDir"
commandLine './scripts/flank_test.sh'
}
assembleAcceptanceTest.mustRunAfter('assembleAppApkForFirebase', 'assembleTestApkForFirebase')
@android10
android10 / pr.md
Created October 27, 2017 10:16 — forked from piscisaureus/pr.md
Checkout github pull requests locally

Locate the section for your github remote in the .git/config file. It looks like this:

[remote "origin"]
	fetch = +refs/heads/*:refs/remotes/origin/*
	url = git@github.com:joyent/node.git

Now add the line fetch = +refs/pull/*/head:refs/remotes/origin/pr/* to this section. Obviously, change the github url to match your project's URL. It ends up looking like this:

@android10
android10 / xps-9370.md
Created May 30, 2018 07:31 — forked from greigdp/xps-9370.md
Dell XPS 13 (9370) Archlinux Install Notes

Install Notes - Dell XPS 13 (9370) 2018

The laptop works well on Archlinux. A few notes based on the installation guide for the previous version.

Intel GPU Power Saving

Per the Arch wiki, more power can be saved by creating /etc/modprobe.d/i915.confwith the following content:

options i915 modeset=1 enable_rc6=1 enable_fbc=1 enable_guc_loading=1 enable_guc_submission=1 enable_psr=1
@android10
android10 / .bashrc
Created December 15, 2017 22:04
Fancy prompt with git branch support
# Fancy Terminal Prompt ----------------------------------------------------------
txtcyn=$'\e[0;36m' # Cyan
txtred=$'\e[0;31m' # Red
txtwht=$'\e[0;37m' # White
txtrst=$'\e[0m' # Text Reset
function parse_git_branch() {
git branch 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/ (\1)/'
}
@android10
android10 / executeShellInGradle
Created January 9, 2019 17:02 — forked from rishabhmhjn/executeShellInGradle
Executing shell commands and getting output in gradle
def getVersionName = { ->
def hashStdOut = new ByteArrayOutputStream()
exec {
commandLine "git", "rev-parse", "--short", "HEAD"
standardOutput = hashStdOut
}
def buildNumberStdOut = new ByteArrayOutputStream()
exec {
commandLine 'echo', "$BUILD_NUMBER"
@android10
android10 / docker.md
Last active February 15, 2019 10:47
Docker useful commands

Stop all running containers.

docker stop $(docker ps -a -q)

Removes one or more images.

docker rmi my_image

Removes one or more images (with force).

docker rmi -f my_image

Kill all running containers.

@android10
android10 / [FEDORA] gitkraken
Last active November 13, 2019 18:59 — forked from aelkz/[FEDORA] gitkraken
How to install gitkraken on Fedora/RedHat + launcher icon
#!/bin/bash
# Download GitKraken
wget https://release.gitkraken.com/linux/gitkraken-amd64.tar.gz
# copy the downloaded file into /opt directory
cp gitkraken-amd64.tar.gz /opt/gitkraken
cd /opt
@android10
android10 / AndroidVersionizer.kt
Last active November 27, 2020 12:51
Android Version Code Generator
//Code
package com.fernandocejas.android
import java.time.*
class Versionizer(private val localDateTime: LocalDateTime = LocalDateTime.now()) {
val versionCode = generateVersionCode()
private fun generateVersionCode(): Int {
@android10
android10 / README.md
Last active November 29, 2020 00:50
Keep a FORKED repository synced with UPSTREAM on Github

Configure a remote that points to the upstream repository in Git.

  • List the current configured remote repository for your fork.
git remote -v
origin  git@github.com:YOUR_USERNAME/YOUR_FORK.git (fetch)
origin  git@github.com:YOUR_USERNAME/YOUR_FORK.git (push)