Skip to content

Instantly share code, notes, and snippets.

@courville
courville / domoticz-closerollershutters.sh
Last active January 4, 2019 14:03
update domoticz scene timer to close roller shutters at dusk but not before 8pm and not after 10pm at Paris location
#!/bin/sh
#
# domoticz-closerollershutters
# use sunwait to get civil dusk time to calculates when to close roller shutters with the constraints to be in this interval >20h <22h, civildusk i.e. min(max(civildusk,20h),22h)
tdusk=`/usr/local/bin/sunwait -p 48.866667N 2.333333W | grep "Sun rises" | sed "s/^.* sets \([0-9]*\) .*$/\1/g"`
hdusk=`echo $tdusk | cut -c 1-2`
mdusk=`echo $tdusk | cut -c 3-4`
sdusk=`date -d"$hdusk:$mdusk" +%s`
notbefore=`date -d"20:00" +%s`
@courville
courville / fixsambamangled.sh
Created January 4, 2019 14:07
fix filenames to avoid samba client name mangling
find . -type f -name \*"[\*\?\:<>\\\"\|]"\* -print0 | xargs -0 rename -v 's/[\*\?\:<>\\\"\|]/_/g'
@courville
courville / adbdate.sh
Created January 4, 2019 14:10
force date and time via adb based on host result
adb shell su root date -u @$(date -u +%s)
@courville
courville / sadb.sh
Created January 4, 2019 14:12
adb connect on a chromebook crostini container to android
adb connect 100.115.92.2:5555
@courville
courville / smbcli.java
Last active February 17, 2023 09:13
Simple jcifs-ng cli test program
import jcifs.smb.SmbFile;
import jcifs.context.BaseContext;
import jcifs.smb.NtlmPasswordAuthenticator;
import jcifs.CIFSContext;
import jcifs.CIFSException;
import jcifs.smb.SmbException;
import jcifs.smb.SmbAuthException;
import java.net.MalformedURLException;
@courville
courville / SurfaceController.java.diff
Created December 10, 2019 17:27
SurfaceController.java.diff
diff --git a/src/main/java/com/archos/mediacenter/video/player/SurfaceController.java b/src/main/java/com/archos/mediacenter/video/player/SurfaceController.java
index 089df18..4ebd723 100644
--- a/src/main/java/com/archos/mediacenter/video/player/SurfaceController.java
+++ b/src/main/java/com/archos/mediacenter/video/player/SurfaceController.java
@@ -20,6 +20,7 @@ import com.archos.medialib.IMediaPlayer;
import android.graphics.SurfaceTexture;
import android.opengl.GLSurfaceView;
+import android.os.Build;
import android.util.Log;
@courville
courville / a.diff
Created December 12, 2019 08:50
attempt scale to fit with crop for good aspect ratio on amlogic
diff --git a/external/android/libsfdec/sfdec_ndkmediacodec.cpp b/external/android/libsfdec/sfdec_ndkmediacodec.cpp
index 57f6c7e..6c14586 100644
--- a/external/android/libsfdec/sfdec_ndkmediacodec.cpp
+++ b/external/android/libsfdec/sfdec_ndkmediacodec.cpp
@@ -19,7 +19,7 @@
#ifdef __ANDROID_API__
#undef __ANDROID_API__
-#define __ANDROID_API__ 21
+#define __ANDROID_API__ 26
@courville
courville / a-no_init_renderer.diff
Created December 13, 2019 14:06
avos: do not apply MediaCodec AR
diff --git a/external/android/libsfdec/sfdec_ndkmediacodec.cpp b/external/android/libsfdec/sfdec_ndkmediacodec.cpp
index 57f6c7e..56752c0 100644
--- a/external/android/libsfdec/sfdec_ndkmediacodec.cpp
+++ b/external/android/libsfdec/sfdec_ndkmediacodec.cpp
@@ -76,12 +76,12 @@ static int init_renderer(sfdec_priv_t *sfdec)
if (format != NULL) {
if (AMediaFormat_getInt32(format, "width", &width)) {
- LOG("width changed: %d -> %d", sfdec->width, width);
- sfdec->width = width;
@courville
courville / m-cursorwindow.diff
Created January 3, 2020 07:53
fight Row too big to fit into CursorWindow
diff --git a/src/com/archos/mediascraper/AutoScrapeService.java b/src/com/archos/mediascraper/AutoScrapeService.java
index 256242c..4115703 100644
--- a/src/com/archos/mediascraper/AutoScrapeService.java
+++ b/src/com/archos/mediascraper/AutoScrapeService.java
@@ -22,8 +22,12 @@ import android.app.Service;
import android.content.ContentValues;
import android.content.Context;
import android.content.Intent;
+import android.database.AbstractWindowedCursor;
import android.database.ContentObserver;
@courville
courville / smallqueries.java
Last active December 29, 2021 18:22
avoid SQLiteBlobTooBigException: Row too big to fit into CursorWindow
// run small queries
static final int WINDOW_SIZE = 1000;
Cursor cursor = getFileListCursor(PARAM_ALL, null);
final int numberOfRows = cursor.getCount();
cursor.close();
int index = 0;
int window = WINDOW_SIZE;