Skip to content

Instantly share code, notes, and snippets.

@walruskhan
walruskhan / globalxml.php
Created January 22, 2016 08:59
Displays Magento's final XML structure after it has parsed all Module configs. Very useful for debugging Magento.
<?php
header("Content-Type: text/xml");
require_once("app/Mage.php");
echo Mage::app()->getConfig()->getXmlString();
@walruskhan
walruskhan / CSV_Util.php
Last active February 3, 2016 00:17
A small wrapper class around common CSV format functions (Comma Separated Values).
<?php
// Copyright (c) 2016 Greg C
// 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:
@walruskhan
walruskhan / 000-default.conf
Created February 7, 2016 11:29
Apache Mass Hosting with fallback
<VirtualHost *:80>
ServerAdmin webmaster@localhost
ServerName default.local
DocumentRoot /vagrant
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
<Directory /vagrant>
Options Indexes FollowSymlinks
@walruskhan
walruskhan / LineStripGeneratorComponent.cs
Last active January 29, 2022 20:18
Pass a linestrip to a Unity URP pipeline via a material, and draw a quad at each line segment
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
[RequireComponent(typeof(MeshFilter))]
[RequireComponent(typeof(MeshRenderer))]
[ExecuteAlways]
public class CreateGeometryComponent : MonoBehaviour
{
[Range(0, 100)]
class Program
{
private static readonly ProxyGenerator Generator = new ProxyGenerator();
private static readonly Dictionary<object, object> InstanceMap = new Dictionary<object, object>();
public static T MakePettable<T>() where T : class, new() {
var pettableInterceptor = new MyPettableInterceptor();
var proxy = Generator.CreateClassProxy<T>(new CallLoggerInterceptor(), pettableInterceptor);
InstanceMap.Add(proxy, pettableInterceptor);
return proxy;
@walruskhan
walruskhan / DebugUtil.cs
Created July 18, 2022 09:32
Unity Editor Script: Draws a 2D circle in screenspace, useful for debugging
// Usage, render in OnSceneGUI as-per usual
SceneView.duringSceneGui += ()=>GUI2DCircle(Event.current.mousePosition, 20.0f);
/// <summary>
/// Draws a 2D circle on the screen
/// </summary>
/// <param name="screenPosition">Position on screen</param>
/// <param name="radius">Radius of circle</param>
public static void GUI2DCircle(Vector2 screenPosition, float radius)
{
<Query Kind="Program">
<NuGetReference>NUnit</NuGetReference>
<NuGetReference Version="3.15.2">NUnit.Console</NuGetReference>
<NuGetReference>NUnit.ConsoleRunner</NuGetReference>
<NuGetReference>NUnit.Engine</NuGetReference>
<NuGetReference>NUnitLite</NuGetReference>
<Namespace>NUnit.Engine</Namespace>
<Namespace>NUnit.Framework</Namespace>
<Namespace>System.Windows</Namespace>
<Namespace>System.Windows.Controls</Namespace>
@walruskhan
walruskhan / pythonvenv.psm1
Last active November 20, 2022 05:59
Automatically load python virtualenv if found in current directory, or parent directories, or specific directory.
function Load-Pyenv {
param (
[string][Parameter(ValueFromPipeline)] $RootPath,
[switch] $TraverseParentDirectories = $false
)
if (-not $RootPath) {
$RootPath = (Get-Location).Path
}
$RootPath = Resolve-Path $RootPath
@walruskhan
walruskhan / instructions
Created April 19, 2025 11:17
Setting up vbcc, vlink, vasm and NDK to build binary for A600+
# Transcribed from https://www.youtube.com/watch?v=vFV0oEyY92I
# Working on linux as-of 2025-04-19
> mkdir -p ~/vbcc_tools # directory for storing downloaded files and building software
> mkdir -p ~/amiga_sdk/vbcc # installation directory for dev env and contains compiler software
# download vbcc target files and service patches
> cd ~/vbcc_tools
> wget http://server.owl.de/~frank/tags/vbcc0_9d.tar.gz
> wget http://server.owl.de/~frank/vbcc/2014-12-30/vbcc_target_m68k-amigaos.lha