Skip to content

Instantly share code, notes, and snippets.

@jasraj
jasraj / lunar-sensor-compile.sh
Created August 8, 2024 10:51
Lunar External Sensor Compile Command - adafruit_feather_esp32s3_tft
/usr/bin/python3 -m esphome -s ssid "" -s password "" -s board adafruit_feather_esp32s3_tft -s platform esp32 -s platform_version platformio/espressif32@6.8.1 -s sda 42 -s scl 41 run /tmp/lunarsensor/esp32dev/lunar.yaml --no-logs --device /dev/cu.usbmodem11401
@jasraj
jasraj / strdd.q
Created February 26, 2021 18:02
kdb String Deduplication
/ q).Q.w[]`used
/ 385648
/ 1. Generate some strings with repeats
/ q).Q.w[]`used
/ 10482848
strs:.Q.an @/:(mod[;count .Q.an] 4 cut til 1000000);
/ 2. Deduplicate
/ q).Q.w[]`used
@jasraj
jasraj / java-start.sh
Last active February 23, 2017 13:39
Java Command Line Start - Linux
#!/usr/bin/env bash
# Start command used in BuaBook for all Java applications
# Requires Java 7u101 or 8u92 for CrashOnOutOfMemoryError flag support
JAR_TO_RUN=/path/to/jar.jar
JAVA_LOG_FILE=/path/to/log/file.log
JAVA_HEAPDUMP_LOC=/path/to/dump/dir/
JAVA_ERROR_FILE=/path/to/error/file.err
@jasraj
jasraj / zfs-native-kernel-downgrade.sh
Last active January 12, 2017 13:43
Updates GRUB to boot with the previous good kernel version (4.4.0-57) for zfs-native 0.6.5.7
# zfs-native 0.6.5.7 - Kernel Downgrade to 4.4.0-57
# Does not build with 4.4.0-59
# Install previous good kernel
apt-get install linux-image-4.4.0-57-generic linux-image-extra-4.4.0-57-generic
# Replace primary boot kernel (vmlinuz and initrd.img) in grub.cfg
sed -E "s/\/(vmlinuz|initrd\.img)-4\.4\.0-59-generic/\/\1-4.4.0-57-generic/g" /boot/grub/grub.cfg > /tmp/grub-modified-4.4.0-57.cfg
# CHECK THE GENERATED FILE (look for code within "menuentry 'Ubuntu'") for updated kernel version
@jasraj
jasraj / haproxy.cfg
Created January 9, 2017 11:10
HAProxy: Redirect "fake" SPA URLs to /, files (with extension) get passed through to Apache
# Redirect all fake URLs (that don't contain a .) to / (anything after ? is OK, but not sent to Apache)
# URL request format: GET /requested/url?optionalParams HTTP/1.1
reqirep ^([^\ ]*\ /)(([^.]*)|([^.]*\?.*))(\ .*)$ \1\5