Skip to content

Instantly share code, notes, and snippets.

View CodeZombie's full-sized avatar
🌵

Jeremy Clark CodeZombie

🌵
View GitHub Profile
@CodeZombie
CodeZombie / expand.js
Last active March 3, 2024 02:44
Expand All Images in 4chan Thread Greasemonkey Extension
// ==UserScript==
// @name Expand All Images
// @namespace zombiearmy.expandimage
// @description Expand all images in a 4chan thread
// @match *://boards.4chan.org/*
// @match *://boards.4channel.org/*
// @version 2
// @grant none
// ==/UserScript==
@CodeZombie
CodeZombie / ssd1306esp8266.txt
Created May 2, 2017 21:07
SSD1306 on the ESP8266 D1 Mini
Getting the SSD1306 OLED Display to work on the ESP8266 via D1 Mini.
First, open your arduino IDE, and go to preferences.
In the "Additional Boards Manager URLs" field, enter "http://arduino.esp8266.com/stable/package_esp8266com_index.json"
press "okay"
Now go to to "Tools->Board->Boards Manager"
Find "esp8266" by "ESP8266 Community", and install it. This installs the toolchain and libraries needed.
Now under "Board", select your esp8266 board, in this case, the d1 mini.
@CodeZombie
CodeZombie / instructions.md
Last active February 6, 2024 20:15
CozyLife Smart Bulb with Home Assistant

How To: Set Up your Stupid Fucking 4 Dollar "Cozy-Life" Wi-Fi Smart Bulb with Home Assistant with Minimal Hair-Pulling

Installing Home Assistant with Docker Compose

This parts simple enough, but requires some adjusting of the official instructions to get working. Most instructions online tell you that your docker-compose.yml file needs to have a network_mode: host in there. I dunno about that! Works fine for me without that, so we're going to not.

version: '3'
services:
 homeassistant:
@CodeZombie
CodeZombie / m8_headless_gpio_audio_out
Created December 12, 2023 05:02
M8 headless GPIO Audio Out
The M8 Headless is so cool!
Except that it wants to send audio over USB! That shit sucks! Especially on android where it doesn't work at all!
Solution: Hook a PCM5102 up to the Teensy 4.1 running m8 headless! It actually works!
Pins:
PCM5012 -> TEENSY
SCK -> 23
BCK -> 21
DIN -> 7
@CodeZombie
CodeZombie / supersearch.py
Created December 1, 2023 18:00
Given a huge directory a files, this script will search the content of each file, and copy it to a new directory if it contains a substring. Threaded.
import os
import threading
import shutil
from collections import namedtuple
ThreadWithData = namedtuple('thread', 'thread, filecount')
# Constants
MAX_THREADS = 12
FILES_PER_THREAD = 500
@CodeZombie
CodeZombie / fastboot_instructions.txt
Created September 3, 2023 20:13
How to fastboot into the fucking redmi note 7
I don't think anyone, at any point, actually wrote this shit down, so here I am, doing God's work:
1. Download `http://bigota.d.miui.com/tools/xiaomi_usb_driver.rar`
2. Extract.
3. Connect your phone to the pc, boot into fastboot mode.
4. In Device Manager, select the device, select `update driver`
5. Choose `browse my computer for drivers` and select the xiaomi usb driver folder.
6. It will install something, but it'll be the wrong one.
7. Select Update Driver again, choose `browse my computer for drivers`, but this time click `let me pick from a list of available drivers`
8. Select the `bootloader` option.
@CodeZombie
CodeZombie / plexpowerd.rb
Created April 22, 2023 19:08
plexpowerd.rb
#Plexhometheater closes itself after 30 minutes of inactivty
#This script checks to see if plexhometheater is off, and if it is,
#checks for any major network traffic (to indicate movie stream, or file xfer)
#if no network activity is detected, the computer shuts down.
#if network activity IS detected, plexhometheater is started again
def plexIsRunning()
command = `ps -ef|grep -v grep|grep /opt/plexhometheater/bin/plexhometheater`
if command == "" then
return false
end
@CodeZombie
CodeZombie / ugh.md
Last active April 4, 2023 06:27
Seagate Ironwolf Sucks

The Seagate Ironwolf is insane. It spins up and down like 5 times a minute by default. Insane behavior, and it results in a massive Load_Cycle_Count which theoeretically will result in the premature death of the drive.

find the disk in question with sudo fdisk -l

You can check the Load_Cycle_Count with sudo smartctl -a /dev/sdc

wow, look at that load cycle count. Not good! The max the drives are designed for is 600,000, and if you do the math from the Power_On_Hours you can calculate how much life your new drive has. And it's proably not much~

Let's check the current APM setting: sudo hdparm -B /dev/sdc

@CodeZombie
CodeZombie / safe.py
Last active March 27, 2023 03:26
a drop-in replacement for Automatic1111's `safe.py` which as it turns out, is not safe at all :)
# An actual safe model loader.
# I consider this file to actually be safe because it physically cannot load pickle file.
# If you try to load a pickle file, it will instead look for a safetensors file with the same name and try to load that.
# If it does find a suitable Safetensors alternative, it will load it in such a way that makes it compatible with all pickle-related code (params_ema/params checking)
# This code was written by Jeremy C (badnoise.net)
import safetensors.torch
import torch
@CodeZombie
CodeZombie / gridmap_godot
Created October 3, 2020 21:05
How to: Create a 3d Gridmap in Godot 3.2
Section A: Preparing your models in Blender.
1. In blender, open up one of your 3d tiles.
2. Center it in the scene and have it sit directly above y=0
3. Export it as a .obj file
Repeat these steps for every tile in the tileset.
Section B: Setup in Godot
1. Create a new scene with a spatial node.
2. Create a new folder called "Models" and drag your .obj files in there.
3. Drag all your models into the scene as children of Spatial. They should all be of type MeshInstance.