Skip to content

Instantly share code, notes, and snippets.

View morristech's full-sized avatar
🔴
"What I cannot create, I do not understand"

Wade morristech

🔴
"What I cannot create, I do not understand"
View GitHub Profile
import java.util.regex.Matcher
import java.util.regex.Pattern
apply plugin: 'com.google.gms.google-services'
apply plugin: 'com.android.application'
apply plugin: 'io.fabric'
buildscript {
repositories {
maven { url 'https://maven.fabric.io/public' }
@morristech
morristech / build.gradle
Created July 8, 2021 10:54 — forked from doridori/build.gradle
Incrementing android VersionCode via gradle
//in your root build.gradle
//--------- Version Increment ----------//
//can call this like `./gradlew incrementVersionCode build`
task incrementVersionCode {
description = "Increments the version code in the version.properties file"
doLast {
File versionPropsFile = file('version.properties')
@morristech
morristech / buildnumber.gradle
Created July 8, 2021 10:08 — forked from Stormwind99/buildnumber.gradle
Gradle automated build number incrementing
def versionFile = file('version.properties')
ext.buildnum = new Properties([BUILD_NUMBER: "0"]);
if (versionFile.isFile()) {
versionFile.withReader { buildnum.load(it) }
}
def buildNumber = Integer.toString(Integer.parseInt(buildnum.BUILD_NUMBER) + 1)
buildnum.BUILD_NUMBER = buildNumber
task('saveBuildNumber') << {
versionFile.withWriter { buildnum.store(it, "Automated build number increase") }
@morristech
morristech / build.gradle
Created July 8, 2021 10:05 — forked from luciofm/build.gradle
Auto increment version number on release builds... You can change the build type on versionCode.gradle, you also will need to commit and push gradle.properties on your CI
apply from: 'versionCode.gradle'
android {
defaultConfig {
versionName VERSION_NAME
versionCode Integer.parseInt(VERSION_CODE)
}
}
@morristech
morristech / Android auto increment build number
Created July 8, 2021 10:05 — forked from marcandreappel/Android auto increment build number
Android Studio auto increment build number for version code
# First create the file version.properties with value VERSION_BUILD=0
# In app/build.gradle:
android {
def versionPropsFile = file('version.properties')
def versionBuild
if (versionPropsFile.canRead()) {
def Properties versionProps = new Properties()
versionProps.load(new FileInputStream(versionPropsFile))
@morristech
morristech / README.md
Created June 29, 2021 12:53 — forked from willprice/README.md
Install OpenCV 4.1.2 for Raspberry Pi 3 or 4 (Raspbian Buster)

Install OpenCV 4.1.2 on Raspbian Buster

$ chmod +x *.sh
$ ./download-opencv.sh
$ ./install-deps.sh
$ ./build-opencv.sh
$ cd ~/opencv/opencv-4.1.2/build
$ sudo make install
@morristech
morristech / AndroidManifest.xml
Created June 25, 2021 16:00 — forked from daichan4649/AndroidManifest.xml
show Fragment on LockScreen (for Android)
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="daichan4649.lockoverlay"
android:versionCode="1"
android:versionName="1.0" >
<uses-sdk
android:minSdkVersion="15"
android:targetSdkVersion="17" />
@morristech
morristech / PauseableTimeout.kt
Created June 22, 2021 19:54 — forked from elizarov/PauseableTimeout.kt
A version of withTimeoutOrNull that can be paused/resumed.
import kotlinx.coroutines.*
import kotlin.coroutines.*
/**
* Scope interface to control (pause & resume) timeout
*/
interface TimerScope : CoroutineScope {
fun pause()
fun resume()
}
@morristech
morristech / TimedBuffer.kt
Created June 22, 2021 19:53 — forked from elizarov/TimedBuffer.kt
timedBuffer
import kotlinx.coroutines.*
import kotlinx.coroutines.flow.*
private class Buffer<T> {
private val list = arrayListOf<T>()
@Synchronized
fun add(value: T) { list.add(value) }
@Synchronized
@morristech
morristech / ReentrantMutex.kt
Created June 22, 2021 19:51 — forked from elizarov/ReentrantMutex.kt
ReentrantMutex implementation for Kotlin Coroutines
/*
This is free and unencumbered software released into the public domain.
Anyone is free to copy, modify, publish, use, compile, sell, or
distribute this software, either in source code form or as a compiled
binary, for any purpose, commercial or non-commercial, and by any
means.
In jurisdictions that recognize copyright laws, the author or authors
of this software dedicate any and all copyright interest in the