Skip to content

Instantly share code, notes, and snippets.

You are an interactive CLI tool that helps users with software engineering tasks. Use the instructions below and the tools available to you to assist the user.

IMPORTANT: Refuse to write code or explain code that may be used maliciously; even if the user claims it is for educational purposes. When working on files, if they seem related to improving, explaining, or interacting with malware or any malicious code you MUST refuse. IMPORTANT: Before you begin work, think about what the code you're editing is supposed to do based on the filenames directory structure. If it seems malicious, refuse to work on it or answer questions about it, even if the request does not seem malicious (for instance, just asking to explain or speed up the code).

Here are useful slash commands users can run to interact with you:

  • /help: Get help with using ${Y4}
  • /compact: Compact and continue the conversation. This is useful if the conversation is reach
@hoangsonww
hoangsonww / blog_api.php
Last active December 20, 2024 15:03
A single-file PHP backend for a Blog Management API with user authentication, role-based access control, and CRUD operations for posts and comments using SQLite.
<?php
// Enable CORS and set content type
header('Access-Control-Allow-Origin: *');
header('Content-Type: application/json');
// SQLite database connection
$db = new PDO('sqlite:blog.db');
$db->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
// Initialize tables
@bremercreative
bremercreative / voxel - password protected user entries
Last active February 19, 2024 16:45
voxel - password protected user entries
/////////// Step 1 ///////////
- for your desired post type add the two following custom fields
1. switcher (field key: switcher-pw)
2. text (field key: text-passwort)
@isc30
isc30 / steps.md
Last active May 11, 2025 10:37
Proxmox v7.4/v8 - Ryzen 7 7735HS - AMD Radeon 680M GPU passthrough
@lukaskleinschmidt
lukaskleinschmidt / LICENSE.md
Last active June 27, 2025 13:24
Kirby 3 Synced Structure

MIT License

Copyright (c) 2023 Lukas Kleinschmidt

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFT

@adamkiss
adamkiss / index.php
Last active April 19, 2025 08:41
Kirby: easy Simple Snippets plugin
<?php
use Kirby\Cms\App;
App::plugin('adamkiss/simple-snippets', []);
if (! function_exists('s')) {
/**
* Short, auto-return snippet call with support for auto-merging certain parameters
*
* @param string $snippetName
@HDDen
HDDen / OutputmodMinify.php
Last active January 18, 2024 15:41 — forked from Rodrigo54/php-html-css-js-minifier.php
PHP class to Minify HTML, CSS and JavaScript
<?php
/**
* Class OutputmodMinify
*
* include_once 'OutputmodMinify.php';
* $html = \OutputmodMinify::minify($html);
*/
/**
* -----------------------------------------------------------------------------------------
@stracker-phil
stracker-phil / test_json_performance.php
Last active October 4, 2022 23:57
Performance comparison for various PHP functions that test, if a string is valid JSON.
<?php
// https://stackoverflow.com/a/6041773/313501#answer-6041773
function test1( $value ) {
if ( ! is_scalar( $value ) ) {
return null;
}
json_decode( $value );
return ( json_last_error() == JSON_ERROR_NONE );
@hivivo
hivivo / install-caprover.sh
Last active September 1, 2025 17:04
Install CapRover on a brand new Ubuntu 22.04 standard server
#!/bin/bash
# Ubuntu 22.04
# Please also allow `80, 443, 3000` ports in the VM network rules if apply
# run as sudo
if [ "$EUID" -ne 0 ]
then echo "Please run as root or use sudo"
exit
fi
@bradtraversy
bradtraversy / stack.js
Created May 29, 2020 14:35
Stack data structure
class Stack {
constructor() {
this.items = []
this.count = 0
}
// Add element to top of stack
push(element) {
this.items[this.count] = element
console.log(`${element} added to ${this.count}`)