Skip to content

Instantly share code, notes, and snippets.

View vonox7's full-sized avatar

Valentin Slawicek vonox7

View GitHub Profile
@vonox7
vonox7 / MoveGsuiteDirectoryRecursively.kt
Created January 25, 2021 10:19
Moves a folder from a g suite folder to another. Useful when file is not owned and therefore can't be moved in the google drive web ui.
package com.example.gsuite
import java.io.File
import java.io.FileNotFoundException
fun copyGsuiteDirectoryRecursively() {
val originPrefix = "/Volumes/GoogleDrive/My Drive/origin"
val targetPrefix = "/Volumes/GoogleDrive/Shared drives/destination"
fun String.isIgnored() = this.endsWith("/Icon\r") || this.endsWith("/.DS_Store")
@vonox7
vonox7 / migrateStrings.js
Last active December 21, 2020 20:43 — forked from rajiteh/mongo_search_and_replace.js
Recursive MongoDB fulltext deep string replacement migration
/*
Recursively traverses all collections and objects/arrays contained within documents replacing every
instance of 'find' with 'replace'.
mongo <db_name> mongo_search_and_replace.js
*/
function escapeRegExp(str) {
return str.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g, "\\$&");
}
@vonox7
vonox7 / threaddump
Created March 4, 2020 10:00
Sentry JVM Threadleak
305 live threads (305 peak threads):
sentry-pool-30-thread-1/main(daemon)-WAITING
jdk.internal.misc.Unsafe.park(Unsafe.java:-2)
java.util.concurrent.locks.LockSupport.park(LockSupport.java:194)
java.util.concurrent.locks.AbstractQueuedSynchronizer$ConditionObject.await(AbstractQueuedSynchronizer.java:2081)
java.util.concurrent.LinkedBlockingDeque.takeFirst(LinkedBlockingDeque.java:483)
java.util.concurrent.LinkedBlockingDeque.take(LinkedBlockingDeque.java:671)
java.util.concurrent.ThreadPoolExecutor.getTask(ThreadPoolExecutor.java:1054)
java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1114)
java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
import io.ktor.application.*
import io.ktor.http.HttpMethod
import io.ktor.pipeline.PipelinePhase
import io.ktor.response.respond
import io.ktor.routing.Routing
import io.ktor.routing.RoutingApplicationCall
import io.ktor.routing.route
import io.ktor.server.engine.embeddedServer
import io.ktor.server.jetty.Jetty
import io.ktor.util.AttributeKey
@vonox7
vonox7 / MainActivity.kt
Created April 14, 2017 17:21
Realm Sort Bug
package com.moshbit.realmsortbug
import android.app.Activity
import android.content.Context
import android.os.Bundle
import io.realm.Realm
import io.realm.RealmConfiguration
import io.realm.RealmObject
import io.realm.Sort
Stacktrace with "Ljava/lang/Object;"
07-25 17:19:05.399 5597-5597/com.moshbit.mailclient A/art: art/runtime/java_vm_ext.cc:410] JNI DETECTED ERROR IN APPLICATION: JNI GetObjectField called with pending exception java.lang.NoSuchFieldError: no "Ljava/lang/Object;" field "connectionLogger" in class "Lcom/libmailcore/SMTPSession;" or its superclasses
07-25 17:19:05.399 5597-5597/com.moshbit.mailclient A/art: art/runtime/java_vm_ext.cc:410] at void com.libmailcore.SMTPSession.setupNativeConnectionLogger() (SMTPSession.java:-2)
07-25 17:19:05.399 5597-5597/com.moshbit.mailclient A/art: art/runtime/java_vm_ext.cc:410] at void com.libmailcore.SMTPSession.setConnectionLogger(com.libmailcore.ConnectionLogger) (SMTPSession.java:83)
07-25 17:19:05.399 5597-5597/com.moshbit.mailclient A/art: art/runtime/java_vm_ext.cc:410] at void com.moshbit.mailclient.test.asdf(com.libmailcore.SMTPSession) (test.java:16)
07-25 17:19:05.399 5597-5597/com.moshbit.mailclient A/art: art/runtime/java_vm_ext.cc:410] at void com.mosh
Stacktrace with :
if (strcmp ("connectionLogger", fieldName) == 0) {
return env->GetFieldID(c, fieldName, "Lcom/libmailcore/ConnectionLogger;");
} else if (strcmp ("operationQueueListener", fieldName) == 0) {
return env->GetFieldID(c, fieldName, "Lcom/libmailcore/OperationQueueListener;");
}
}
07-25 18:50:31.702 6788-6801/com.moshbit.mailclient A/art: art/runtime/java_vm_ext.cc:410] JNI DETECTED ERROR IN APPLICATION: thread Thread[10,tid=6801,Native,Thread*=0xaaa2fd00,peer=0x12d780a0,"Thread-147"] using JNIEnv* from thread Thread[10,tid=6801,Native,Thread*=0xaaa2fd00,peer=0x12d780a0,"Thread-147"]
07-25 18:50:31.702 6788-6801/com.moshbit.mailclient A/art: art/runtime/java_vm_ext.cc:410] in call to GetObjectClass