Skip to content

Instantly share code, notes, and snippets.

View d4rken's full-sized avatar
🤗
!

Matthias Urhahn d4rken

🤗
!
View GitHub Profile
@d4rken
d4rken / gist:787061bd1f059e789061224a2a886d5e
Created July 16, 2018 19:37
Tutorial for self-hosted mail servers
A collection of guides/sites/posts that you may want to look through when setting up a mail server.
### General
* https://www.digitalocean.com/community/tutorials/how-to-configure-a-mail-server-using-postfix-dovecot-mysql-and-spamassassin
### Postfix (SMTP)
* https://seasonofcode.com/posts/custom-domain-e-mails-with-postfix-and-gmail-the-missing-tutorial.html
* https://seasonofcode.com/posts/setting-up-dkim-and-srs-in-postfix.html
/**
* We need to go deeper!
*/
public static void doHorribleHack() {
try {
try {
Class<?> testCls = Class.forName("dalvik.system.VMRuntime");
Method method = testCls.getDeclaredMethod("setHiddenApiExemptions", String[].class);
} catch (Exception ex) {
// This will fail
package eu.darken.bluemusic.main.core.service.modules.events
import android.media.AudioManager
import android.os.SystemClock
import android.view.KeyEvent
import eu.darken.bluemusic.bluetooth.core.SourceDevice
import eu.darken.bluemusic.main.core.database.ManagedDevice
import eu.darken.bluemusic.main.core.service.BlueMusicServiceComponent
import eu.darken.bluemusic.main.core.service.modules.EventModule
import eu.darken.bluemusic.settings.core.Settings
@d4rken
d4rken / DrawableMatcher.java
Last active August 28, 2019 10:33
Android InstrumentationTest Espresso matcher for Drawable's
/**
* Apache 2.0
*
* @see <a href="https://github.com/stablekernel/EspressoLib/blob/master/src/main/java/com/stablekernel/espressolib/DrawableMatcher.java">Source1</a>
* @see <a href="http://stackoverflow.com/questions/33696488/getting-bitmap-from-vector-drawable">Source2</a>
*/
@SuppressWarnings("SimplifiableIfStatement")
public class DrawableMatcher extends TypeSafeMatcher<View> {
private final int expectedResourceId;
fun claresSimpleQuestion(input: String) : Boolean {
val pattern = Pattern.compile("^[A-Z].*?$")
return pattern.matcher(input).matches()
}
@Test
fun testClaresSimpleQuestion() {
assertThat(claresSimpleQuestion(""),`is`(false))
assertThat(claresSimpleQuestion("a"),`is`(false))
assertThat(claresSimpleQuestion("A"),`is`(true))
@d4rken
d4rken / key.md
Created February 28, 2019 16:06
Twitter (un)official Consumer Key

Twitter Official Consumer Key

Twitter for Android

type:            PIN
Consumer key:    3nVuSoBZnx6U4vzUxf5w
Consumer secret: Bcs59EFbbsdF6Sl9Ng71smgStWEGwXXKSjYvPVt7qys

Twitter for iPhone

type:            PIN

Consumer key: IQKbtAYlXLripLGPWd0HUA

@d4rken
d4rken / gist:9812e7e518079b045b3f2db952a5993d
Last active January 12, 2019 09:19
Random AppCleaner Crash maybe samsung/greatltexx/greatlte:8.0.0/R16NW/N950FXXS5CRK4:user/release-keys
java.lang.RuntimeException:
at android.graphics.BaseCanvas.throwIfCannotDraw (BaseCanvas.java:55)
at android.view.DisplayListCanvas.throwIfCannotDraw (DisplayListCanvas.java:226)
at android.view.RecordingCanvas.drawBitmap (RecordingCanvas.java:97)
at android.graphics.drawable.BitmapDrawable.draw (BitmapDrawable.java:529)
at android.widget.ImageView.onDraw (ImageView.java:1349)
at android.view.View.draw (View.java:20357)
at android.view.View.updateDisplayListIfDirty (View.java:19302)
at android.view.View.draw (View.java:20080)
at android.view.ViewGroup.drawChild (ViewGroup.java:4421)
package stack.saas.backend.webserver.graphql
import com.expedia.graphql.schema.generator.WiringContext
import com.expedia.graphql.schema.hooks.SchemaGeneratorHooks
import graphql.schema.GraphQLType
import org.bson.types.ObjectId
import stack.saas.backend.common.graphql.coercing.InstantCoercing
import stack.saas.backend.common.graphql.coercing.ObjectIdCoercing
import stack.saas.backend.common.graphql.coercing.UUIDCoercing
import stack.saas.backend.webserver.graphql.components.auth.permission.Permission
@AppComponent.Scope
public class AppRepo {
private final Object appMapLock = new Object();
private Map<String, PackageInfo> appMap;
private final IPCFunnel ipcFunnel;
@Inject
public AppRepo(IPCFunnel ipcFunnel) {this.ipcFunnel = ipcFunnel;}
public Map<String, PackageInfo> getAppMap(boolean refresh) {
sailfish:/data/data/com.android.documentsui/shared_prefs # cat com.android.documentsui_preferences.xml
<?xml version='1.0' encoding='utf-8' standalone='yes' ?>
<map>
<int name="0|com.commonsware.android.documenttree||Documents" value="-1" />
</map>