Skip to content

Instantly share code, notes, and snippets.

View bennihtm's full-sized avatar

Benjamin bennihtm

View GitHub Profile
@bennihtm
bennihtm / bulk-convert-avif.ps1
Last active January 1, 2024 12:26 — forked from frozenex/bulk-convert.ps1
Bulk convert images to webp format using cwebp library in windows
# Copy this file to any directory containing images & then run this script in powershell
# Get all png images in the current directory & convert it to avif format
$images = Get-ChildItem -Path (Get-Location) -Filter *.jpg
foreach ($image in $images) {
$fileName = $image.DirectoryName + "\" + $image.BaseName + ".avif"
magick.exe convert $image.FullName $fileName
Write-Output "Converted $fileName."
}
@bennihtm
bennihtm / server.js
Created December 6, 2022 15:33
activitypub-troll.cf source code probably
var code = require("fs").readFileSync(__filename, "utf8");
var rand = () => (Math.floor(Math.random() * 1e13)).toString(36);
var server = require("http").createServer(function(req, res) {
try {
if (!process.env.PROD) console.log(new Date().toLocaleString(), req.headers["x-forwarded-for"], req.headers.host, req.url, '"'+req.headers["user-agent"]+'"');
if (req.url.startsWith("/.well-known/webfinger?resource=acct")) {
var c = decodeURIComponent(req.url.substring(36));
var name = c.substring(1, c.indexOf("@"));
res.writeHead(200, {"Content-Type": "application/json; charset=utf-8"});
@bennihtm
bennihtm / .htaccess
Last active December 2, 2022 08:57
Wordpress .htaccess with WP Super Cache Config
# BEGIN WPSuperCache
# Die Anweisungen (Zeilen) zwischen BEGIN WPSuperCache und END WPSuperCache sind
# dynamisch generiert und sollten nur über WordPress-Filter geändert werden.
# Alle Änderungen an den Anweisungen zwischen diesen Markierungen werden Überschrieben.
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
#If you serve pages from behind a proxy you may want to change 'RewriteCond %{HTTPS} on' to something more sensible
AddDefaultCharset UTF-8
@bennihtm
bennihtm / winstall-everything-i-need.json
Last active July 25, 2022 14:04
WinGet install file for everything I need.
{"$schema":"https://aka.ms/winget-packages.schema.1.0.json","WinGetVersion":"0.3.11201","Sources":[{"Packages":[{"Id":"Mozilla.Firefox","Version":"102.0.1"},{"Id":"7zip.7zip","Version":"22.01"},{"Id":"PuTTY.PuTTY","Version":"0.77.0.0"},{"Id":"Notepad++.Notepad++","Version":"8.4.4"},{"Id":"WinSCP.WinSCP","Version":"5.21.1"},{"Id":"Audacity.Audacity","Version":"3.1.3"},{"Id":"VideoLAN.VLC","Version":"3.0.17.4"},{"Id":"Mozilla.Thunderbird","Version":"102"},{"Id":"VSCodium.VSCodium","Version":"1.69.1"},{"Id":"GIMP.GIMP","Version":"2.10.32"},{"Id":"ShareX.ShareX","Version":"14.1.0"},{"Id":"Malwarebytes.Malwarebytes","Version":"4.5.11.202"},{"Id":"maximmax42.CustomRP","Version":"1.15.1"},{"Id":"Microsoft.WindowsTerminal","Version":"1.13.11431.0"},{"Id":"jely2002.youtube-dl-gui","Version":"2.4.0"},{"Id":"PolyMC.PolyMC","Version":"1.3.2"},{"Id":"Git.Git","Version":"2.37.1"},{"Id":"KDE.Kdenlive","Version":"22.04.3"},{"Id":"Spotify.Spotify","Version":"1.1.90.859.gf1bb1e36"},{"Id":"Transmission.Transmission","Version":"
@bennihtm
bennihtm / openpgp.md
Last active September 30, 2023 08:01
Keyoxide Verification
@bennihtm
bennihtm / php_include.php
Created March 17, 2021 16:53
PHP include from the root of the webserver/domain/whatever.
<?php
$path = $_SERVER['DOCUMENT_ROOT'];
$path .= "/common/header.php";
include_once($path);
?>
@bennihtm
bennihtm / deploy.sh
Created July 12, 2020 11:34
Deploy Hugo Sites to GH Pages
#!/bin/sh
# If a command fails then the deploy stops
set -e
printf "\033[0;32mDeploying updates to GitHub...\033[0m\n"
# Build the project.
hugo -t hugo-theme-codex # if using a theme, replace with `hugo -t <YOURTHEME>`
@bennihtm
bennihtm / localStorage.js
Created July 5, 2020 18:06
Simple Function to manipulate the localStorage
function getLocalStorage(mode, name, content){
if(mode == "w"){
localStorage.setItem(name, content);
return localStorage;
}
else if(mode == "r"){
return localStorage.getItem(name)
}
else if(mode == "d"){
localStorage.removeItem(name)
@bennihtm
bennihtm / cloudSettings
Last active August 22, 2020 09:28
VS Code Settings
{"lastUpload":"2020-08-22T09:28:09.480Z","extensionVersion":"v3.4.3"}
@bennihtm
bennihtm / .htaccess.new
Created June 21, 2020 11:48
my new htaccess
########################################################################
# OPTIMAL .htaccess FILE FOR SPEED AND SECURITY @Version 2019
# ----------------------------------------------------------------------
# @Author: Andreas Hecht
# @Author URI: https://andreas-hecht.com
# License: GNU General Public License v2 or later
# License URI: http://www.gnu.org/licenses/gpl-2.0.html
# Gist URL: https://gist.github.com/IP-CAM/c4c87e36cb5ca630c61f4b47c81e2b43
########################################################################