Skip to content

Instantly share code, notes, and snippets.


Dorian Cussen doridori

View GitHub Profile
doridori / RuntimeKernel.kt
Last active Jan 5, 2022
Runtime Centric Thinking Blog post snippts
View RuntimeKernel.kt
val commandHandler: CommandHandler
var runtimeData: RuntimeData
fun RuntimeKernel.receive(action) {
//the runtime maintains its own main loop
marshallToRuntimeMainThread {
val transition = reduce(action, runtimeData)
runtimeData = transition.runtimeData
//effect system, describes commands and runtimeData state change operations
val transitionOperations = describe(transition)
doridori /
Last active Sep 28, 2017
Beware of the default IV blog post example
public byte[] encrypt(byte[] in)
byte[] iv = new byte[IV_LENGTH];
new SecureRandom().nextBytes(iv);
cipher.init(Cipher.ENCRYPT_MODE, key, new IvParameterSpec(iv));
byte[] cipherBytes = cipher.doFinal(s.getBytes("UTF-8"));
return concat(iv, cipherBytes);
doridori /
Created Mar 31, 2017
Example of a Dagger wrapped pilot stack for Activity/Stack scoped DI.
* A PilotStack that also holds a ref to a Dagger Component. This is useful for easy Activity-Scoped DI as the PilotStack has to already live
* on past the host-Activities config-change events by some mechanism (project dependent).
* @param <D> A Dagger Component to supply all deps for this stacks frames.
//todo unused - here for dagger activity scope refactor (See trello)
public class DaggerPilotStack<D> extends PilotStack
D scopedDaggerComponent;
doridori / 1
Last active Jan 15, 2018
For Adb shell blogpost
View 1
root 1 0 4524 908 SyS_epoll_ 0000000000 S /init
shell 503 1 9952 700 0000000000 S /sbin/adbd
shell 17432 29176 5744 1156 0 7f8b5d6c7c R ps
shell 29176 503 5800 1444 sigsuspend 7f9663f37c S /system/bin/sh
doridori / build.gradle
Last active Jul 8, 2021
Incrementing android VersionCode via gradle
View build.gradle
//in your root build.gradle
//--------- Version Increment ----------//
//can call this like `./gradlew incrementVersionCode build`
task incrementVersionCode {
description = "Increments the version code in the file"
doLast {
File versionPropsFile = file('')
View gist:93364ee7d6c823bde4fe
### Keybase proof
I hereby claim:
* I am doridori on github.
* I am dori ( on keybase.
* I have a public key whose fingerprint is CC45 C7F9 5462 AD1D 729C CA47 83C4 30D2 BC60 9EB5
To claim this, I am signing this object:
doridori /
Last active Aug 29, 2015
Java: Bitshifting Bytes post code samples
byte aByte = -112; //0b1001_0000
byte bByte = (byte) (aByte >> 4); //would expect 0b1111_1001 (-7)
System.out.println(bByte); //-7
byte cByte = (byte) (aByte >>> 4); //would expect 0b0000_1001 (9)
System.out.println(cByte); //-7
doridori /
Last active May 14, 2022
Testing with Dagger, Retrofit & MockWebServer gists
* Allows easy swapping of production and test modules to satisfy Dagger dependencies
public class DaggerHelper
private static ObjectGraph sObjectGraph;
private static final List<Object> productionModules;
doridori /
Created Jun 16, 2014
Standalone Gson Persister for RoboSpice
public final class GsonObjectPersister<T> extends InFileObjectPersister<T>
// ============================================================================================
// ============================================================================================
private final Gson gson;
// ============================================================================================
doridori / gist:c3ec473f5e54969f46c0
Created Jun 13, 2014
robospice dropped result log
View gist:c3ec473f5e54969f46c0
D/dalvikvm﹕ Late-enabling CheckJNI
E/jdwp﹕ Failed sending reply to debugger: Broken pipe
D/dalvikvm﹕ Debugger has detached; object registry had 1 entries
D//﹕ 16:20:13.876 main SpiceManager started.
V//﹕ 16:20:13.877 SpiceManagerThread 0 Binding to service.
D//﹕ 16:20:13.881 main adding request to request queue
V//﹕ 16:20:13.881 SpiceManagerThread 0 Binding to service succeeded.
D//﹕ 16:20:13.887 SpiceManagerThread 0 Waiting for service to be bound.
D/dalvikvm﹕ GC_CONCURRENT freed 182K, 3% free 9243K/9460K, paused 2ms+2ms, total 22ms
D//﹕ 16:20:13.924 main SpiceService instance created.