Skip to content

Instantly share code, notes, and snippets.

@Chisight
Chisight / gemini.py
Last active May 23, 2025 12:24
gemini.py use key in api.conf to access gemini advanced models from shell. this version is a major update with a curses interface and tons of new features.
# geminiapi.py
import curses
import os
import time
import json
import datetime
import glob
import sys
import shutil
import re
#include <ncurses.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <dirent.h>
#include <unistd.h>
#include <sys/types.h>
#include <sys/ipc.h>
#include <sys/shm.h>
#include <sys/sem.h>
@Chisight
Chisight / README.md
Created February 12, 2024 02:34
Intentional superblock corruption in CoreOS and ChromeOS: read only filesystem

CoreOS and ChromeOS implement intentional superblock corruption that shows up as a number of symptoms: dmesg showing: sd 8:0:0:0: [sde] Write Protect is off fsck showing: fsck.ext4: Bad magic number in super-block while trying to open chromeos_15117.112.0_scarlet_recovery_stable-channel_mp-v7.bin mount showing: mount -o offset=$(( 352256 * 512 )) chromeos_15117.112.0_scarlet_recovery_stable-channel_mp-v7.bin scarlet/ mount: scarlet: wrong fs type, bad option, bad superblock on /dev/loop1, missing codepage or helper program, or other error. read only mount success. losetup --offset $(( 352256 * 512 )) /dev/loop0 chromeos_15117.112.0_scarlet_recovery_stable-channel_mp-v7.bin; dumpe2fs /dev/loop0 | grep -i features showing Filesystem features: ext_attr resize_inode dir_index filetype sparse_super large_file FEATURE_R24 FEATURE_R25 FEATURE_R26 FEATURE_R27 FEATURE_R28 FEATURE_R29 FEATURE_R30 FEATURE_R31

to correct the problem you can repair using a backup superblock (if this gets out, they'

@Chisight
Chisight / gist:cdad0c2e2f9a4165f1b86a47f29cf591
Last active February 22, 2025 18:10
Magic Home WiFi LED controller
Corrections to: https://github.com/Danielhiversen/flux_led/issues/53 for the newer Magic Home LED controller.
My Magic Home WiFi LED controller https://www.amazon.com/dp/B08GLSHJGS (non affiliate link) didn't work quite as described in the issue. It has a version identifier AK001-ZJ2145 which is different, so not surprising that it behaves differently. Some of the changes appear to be them actually fixing the well known security problems with these controllers, they're still not safe to put on the public Internet and still will respond with your wifi SSID and password with the following command:
echo -e "AT+WSKEY\r" | nc -u -v -w 3 $IP 48899; echo
I powered the controller up with 12VDC and scanned for new SSIDs. It came up as LEDnet003325A63A where the MAC address ends with 25A63A. I had used the above instructions and managed to soft-brick it so needed to reset to get back to a working state. These controllers no longer revert to AP mode if they can't connect (it was a security problem) so you have to fact
@Chisight
Chisight / nodered.service
Created August 12, 2018 22:14
Node Red systemd file
# systemd service file to start Node-RED
[Unit]
Description=Node-RED graphical event wiring tool
Wants=network.target
Documentation=http://nodered.org/docs/hardware/raspberrypi.html
[Service]
Type=simple
# Run as normal pi user - feel free to change...
@Chisight
Chisight / README.md
Last active November 17, 2021 13:30 — forked from valerio-vaccaro/README.md
Automatical backup for flows

This code is useful for backup the flow at every commit of node-red.

The script actually backup the following file:

  • $HOME/.node-red/flows_$HOSTNAME.json
  • $HOME/.node-red/flows_$HOSTNAME_cred.json

cloning in the same directory with a new name with timestamp.

These should be the default names for any install, but if yours are in a different place, modify the actual URL in the function nodes.