This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#! bun run | |
/** | |
* The author disclaims copyright to this source code. | |
*/ | |
const PAPERLESS_URL = process.env.PAPERLESS_URL ?? ""; | |
const PAPERLESS_TOKEN = process.env.PAPERLESS_TOKEN ?? ""; | |
const PAPERLESS_TAG_ID = process.env.PAPERLESS_TAG_ID ?? 0; | |
const OLLAMA_URL = process.env.OLLAMA_URL ?? ""; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// app/Http/Middleware/PreventOverloading.php | |
namespace App\Http\Middleware; | |
use Closure; | |
use Illuminate\Http\Request; | |
use Symfony\Component\HttpFoundation\Response; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
namespace App\Http\Middleware; | |
use HTMLPurifier; | |
use HTMLPurifier_HTML5Config; | |
use Illuminate\Foundation\Http\Middleware\TransformsRequest; | |
/** | |
* Use HTMLPurifier to purify all inputs with names matching `/[-_]html\s*$/i`. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* For Laravel 10. | |
* Automatically set App and User's locale based on browser's preferred | |
* language and server's `lang/` directory. | |
* @copyright 2024 Joe Koop | |
* @license MIT | |
*/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* For Laravel 10. | |
* Automatically set app locale based on browser's preferred language and server's `lang/` directory. | |
* @copyright 2024 Joe Koop | |
* @license MIT | |
*/ | |
namespace App\Http\Middleware; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* numbers.h - Terse shorthands for numeric types | |
* Copyright (c) 2023 Joe Koop | |
* License: The MIT License (MIT) | |
*/ | |
#include <stdint.h> | |
// E for "exact" | |
typedef int8_t i8e; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** This plugin replaces UNIX timestamps with human-readable dates in your local timezone. | |
* Mouse click on the date field reveals timestamp back. | |
* | |
* @link https://www.adminer.org/plugins/#use | |
* @author Anonymous | |
* @license http://www.apache.org/licenses/LICENSE-2.0 Apache License, Version 2.0 | |
* @license http://www.gnu.org/licenses/gpl-2.0.html GNU General Public License, version 2 (one or other) | |
*/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# Run this as root | |
GOOGLE_API_KEY=AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA | |
TRACCAR_URL='https://traccar.example.com' | |
INTERFACE=wlan0 | |
DEVICE_ID=123456 | |
json=$(sudo iwlist $INTERFACE scan | egrep -o 'Address: .*|Channel:.*|Signal level=.*|Last beacon:.*' | sed -E 's/Address: (.*)/\{"macAddress":"\1",/g' | sed -E 's/Channel:(.*)/"channel":\1,/g' | sed -E 's/Signal level=(.*) dBm/"signalStrength":\1,/g' | sed -E 's/Last beacon: (.*)ms ago/"age":\1}/g') | |
json=$(echo "$json" | head -n 1; echo "$json" | sed -E 's/\{/,{/g' | tail -n +2) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/php | |
<?php | |
/** | |
* This script SSHes into all of my AeroHive Wifi APs, gets a list of current | |
* connected clients from each if them, assembles the list into one, and writes | |
* that list to a JSON file. | |
* | |
* This is intended to be run as a minutely `cron` job. As such, the path of the | |
* output file is the date, formatted to not put a million files in one folder: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(10 - ( | |
substr(isbn, 1, 1) * 1 + | |
substr(isbn, 2, 1) * 3 + | |
substr(isbn, 3, 1) * 1 + | |
substr(isbn, 4, 1) * 3 + | |
substr(isbn, 5, 1) * 1 + | |
substr(isbn, 6, 1) * 3 + | |
substr(isbn, 7, 1) * 1 + | |
substr(isbn, 8, 1) * 3 + | |
substr(isbn, 9, 1) * 1 + |
NewerOlder