Skip to content

Instantly share code, notes, and snippets.

@AnrDaemon
AnrDaemon / ToolMaterials
Created October 15, 2023 17:31 — forked from bonii-xx/ToolMaterials
Tinkers' Construct IMC
/* This first part adds Seared Stone as a material. Toolparts and tool graphics are created automatically by color */
NBTTagCompound tag = new NBTTagCompound();
tag.setInteger("Id", 50); // Unique material ID. Reseved IDs: 0-40 Tinker, 41-45 Iguana Tinker Tweaks, 100-200 ExtraTiC
tag.setString("Name", "Seared Stone"); // Unique material name
tag.setInteger("HarvestLevel", 3); // diamond level
tag.setInteger("Durability", 100);
tag.setInteger("MiningSpeed", 100);
tag.setInteger("Attack", 0); // optional
tag.setFloat("HandleModifier", 0.1f);
tag.setInteger("Reinforced", 0); // optional
@AnrDaemon
AnrDaemon / pre-commit
Created June 16, 2022 12:02
Git hooks
#!/bin/sh
if git rev-parse --verify HEAD >/dev/null 2>&1
then
against=HEAD
else
# Initial commit: diff against an empty tree object
against=$( git hash-object -t tree /dev/null )
fi
@AnrDaemon
AnrDaemon / cloud.rootdir.org-proxy.conf
Last active June 17, 2022 08:46
nginx reverse proxy for own/nextcloud
server {
server_name
cloud.rootdir.org
cloud.darkdragon.lan
;
error_log syslog error;
access_log off;
listen 80;
@AnrDaemon
AnrDaemon / Makefile
Created May 24, 2020 11:56
PHAR / stream_resolve_include_path test
SHELL := /bin/sh
.SHELLFLAGS := -ec
.ONESHELL:
PHAR_FILES := index.php
clean:
-rm index.php example.phar
dist-clean: clean
@AnrDaemon
AnrDaemon / panel.html
Created March 29, 2020 12:16
Manual xdebug trigger script
<!DOCTYPE html>
<html>
<head>
<title>Panel</title>
<link rel="shortcut icon" href="/favicon.png" type="image/png"/>
<link rel="shortcut icon" href="/favicon.ico" type="image/x-icon"/>
<base target="_blank" />
</head>
<body>
@AnrDaemon
AnrDaemon / tc-test.btm
Created March 28, 2020 17:31
TCC crash on return from subroutine call
@ECHO OFF
GOSUB test %[1]
ECHO %[1]:Ok
QUIT
:test [rc]
REM "%[SystemRoot]\System32\cmd.exe" /S /K "EXIT %[rc]"
.\testme.exe %[rc]
@AnrDaemon
AnrDaemon / git-pushing-multiple.rst
Created September 12, 2019 09:10 — forked from rvl/git-pushing-multiple.rst
How to push to multiple git remotes at once. Useful if you keep mirrors of your repo.

Pushing to Multiple Git Repos

If a project has to have multiple git repos (e.g. Bitbucket and Github) then it's better that they remain in sync.

Usually this would involve pushing each branch to each repo in turn, but actually Git allows pushing to multiple repos in one go.

If in doubt about what git is doing when you run these commands, just

@AnrDaemon
AnrDaemon / rollyourown.php
Created June 28, 2019 21:44 — forked from GDmac/rollyourown.php
We don't need no DIC libs / we don't need no deps control
<?php
// Context: I'm trying to argue that DI (and DIC) are great, and DIC libs suck.
// Happy to be proven wrong!
final class Router {
private $dependencies;
public function __construct (Dependencies $dependencies) {
$this->dependencies = $dependencies;
// You might say that this is Service Locator, but it's not. This router is toplevel,
// and toplevel must have access to dependencies. After that it can all just bubble nicely using proper DI.
location ^~ /uploads/documents/ {
alias /volume/data/documents/;
set $auth_pass "$request_uri";
auth_request /auth/documents;
auth_request_set $auth_status "$upstream_status";
}
location ^~ /auth/ {
internal;
proxy_pass "http://back:8080/auth/$auth_pass";
<?php
/** Collection handler for webpage content blocks
*
* @version SVN: $Id: PageUnitsCollection.php 1231 2018-08-11 19:40:50Z anrdaemon $
*/
namespace AnrDaemon\CcWeb\Helpers;
use
AnrDaemon\CcWeb\Objects\PageUnit;