Skip to content

Instantly share code, notes, and snippets.

/**
* @see https://stackoverflow.com/a/62662855
*
// maxDeviation is the difference that is allowed default: 50kb
// Example: targetFileSizeKb = 500 then result will be between 450kb and 500kb
// increase the deviation to reduce the amount of iterations.
*/
export default async function reduceImageSize(
@Shelob9
Shelob9 / adverserial-code-reviewer.md
Created April 10, 2026 17:18
Goes in .github/agents

You are adversarial code reviewer agent. Your job is to review the code changes made by the coder agent, looking for problems, missing tests, and possible security issues.

You are a computer and are concerned with quality and security. Do not tell me I am right, make a table of what is correct and what is not correct. Be specific.

You will work with a coder agent who implements the plans, and a documentor agent who keeps the documentation up to date. When you find an issue, you will communicate it to the coder agent to fix. You will also review the changes after they are made to ensure they are correct and complete.

@Shelob9
Shelob9 / script.js
Last active February 20, 2025 15:09 — forked from spf13/script.js
Download all your Kindle books before Feb 26, 2025
// 1. Log in to your Amazon account
// 2. Go to your Content Library > Books - https://www.amazon.com/hz/mycd/digital-console/contentlist/booksAll/dateDsc/
// 3. Open your browser's Javascript console
// 4. For each page of books, paste this script into the console
(async function () {
// Close the notification if it appears
function closeNotification() {
const notifClose = document.querySelector("span#notification-close");
if (notifClose) {
@Shelob9
Shelob9 / script.js
Created February 20, 2025 15:08 — forked from spf13/script.js
Download all your Kindle books before Feb 26, 2025
// 1. Log in to your Amazon account
// 2. Go to your Content Library > Books - https://www.amazon.com/hz/mycd/digital-console/contentlist/booksAll/dateDsc/
// 3. Open your browser's Javascript console
// 4. For each page of books, paste this script into the console
(async function () {
// Close the notification if it appears
function closeNotification() {
const notifClose = document.querySelector("span#notification-close");
if (notifClose) {
const fs = require('fs');
function readFromEnd(filePath, chunkSize = 1024) {
const stats = fs.statSync(filePath);
let position = stats.size;
let buffer = '';
const lines = [];
const stream = fs.createReadStream(filePath, {
highWaterMark: chunkSize,
import { useState } from "react";
import useCreateTextImage from "./useCreateTextImage";
function App() {
const [text, setText] = useState<string>('');
const imgRef = useCreateTextImage(text, 'black', 'white', { width: 400, height: 200 });
return (
import React from 'react';
export function Td({id,children,className}){
return (
<td id={id} className={className ?? ''}>
{children}
</td>
)
}
export function Th({id,children,className}:{
<?php
/**
* Plugin name: Josh412
*/
add_filer( 'show_admin_bar', '__return_false' );
/**
* Category validation
*/
add_filter('pre_insert_term',function( $term, $taxonomy, $args){
$allowed_parents = [
@Shelob9
Shelob9 / blue.css
Created December 7, 2023 22:42
Tailwind CSS with links styled like links
@tailwind base;
@tailwind components;
@tailwind utilities;
a {
@apply underline text-blue-800 hover:text-blue-400 visited:text-purple-800
}