Skip to content

Instantly share code, notes, and snippets.

@tinsukE
tinsukE / SplashActivity.kt
Last active May 30, 2018 12:25
Simple Splash
class SplashActivity : Activity() {
private var isUserSessionInitialized = false
private var hasBeenShownForMinTime = false
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
initializeUserSession()
scheduleProgressBar()
@tinsukE
tinsukE / SplashActivity.kt
Last active May 30, 2018 12:25
Complicated Splash
class SplashActivity : Activity() {
private var isUserSessionInitialized = false
private var hasBeenShownForMinTime = false
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
initializeApp()
scheduleProgressBar()
@tinsukE
tinsukE / SplashActivity.kt
Last active May 31, 2018 07:37
Coroutines Splash
class SplashActivity : Activity() {
private val creationTime = System.currentTimeMillis()
private var splashJob: Job? = null
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
initializeApp()
}
@tinsukE
tinsukE / Callback.kt
Created May 30, 2018 10:02
Simple Callback
interface Callback<T> {
fun onSuccess(result: T)
fun onError(error: Error)
}
@tinsukE
tinsukE / freebsd_13.2_py-paperless-ngx_patch.md
Last active June 20, 2024 09:26
Patches to install py-paperless-ngx 2.7.2 on FreeBSD 13.2

Patches to install py-paperless-ngx 2.7.2 on FreeBSD 13.2, which can come in handy if you can't upgrade, yet (ex: you run TrueNAS Core).

os.sched_getaffinity.patch

numpy and joblib need to be patched to avoid an exception when calling os.getaffinity():

OverflowError: could not allocate a large enough CPU set

This might be something needed for my system only, which is a FreeBSD 13.1 machine (TrueNAS CORE) hosting a FreeBSD 13.2 jail.

py-threadpoolctl.patch

@tinsukE
tinsukE / install_paperless.sh
Created July 14, 2024 14:27
Script to install py-paperless-ngx 2.11.0 on FreeBSD 13.2
#!/bin/sh
# Script to install py-paperless-ngx 2.11.0 on FreeBSD 13.2
# https://tinsuke.wordpress.com/2024/04/20/how-to-install-py-paperless-ngx-on-freebsd-13/
set DEPS_LIST="py311-pip py311-bleach py311-concurrent-log-handler \
py311-dateparser py311-channels-redis py311-django-allauth \
py311-django-auditlog py311-django-celery-results py311-django-compression-middleware \
py311-django-cors-headers py311-django-extensions py311-django-filter \
py311-django-multiselectfield py311-djangorestframework-guardian py311-drf-writable-nested \