Skip to content

Instantly share code, notes, and snippets.

@cmaher
cmaher / synty_weapon.py
Last active November 21, 2021 17:42
Add a weapon bone to synty models
import sys
import argparse
import pathlib
import subprocess
import os
import time
from mathutils import Vector
import math
try:
import bpy
@cmaher
cmaher / BoxGridMesh.cs
Last active May 29, 2021 16:27
Honeycombed procedural grid of cubes -- I thought this would work for fog of war, but getting the right shader is another question
using System.Collections;
using System.Xml.Schema;
using UnityEngine;
// adapted from this series: https://catlikecoding.com/unity/tutorials/procedural-grid/
public class BoxGridMesh : MonoBehaviour {
public int length;
public int width;
@cmaher
cmaher / BatchSpriteSlicer.cs
Last active January 18, 2021 18:58
Unity Batch Sprite Slicer
using System.Collections.Generic;
using UnityEditor;
using UnityEngine;
// Put this script in the Assets/Editor folder
namespace MaruEditor.Sprites {
// Select a bunch of sprites, and slice them all at once
public class BatchSpriteSlicer : EditorWindow {
[MenuItem("Maru/Slice Selected Sprites")]
static void Init() {
@cmaher
cmaher / chartproxy.sh
Created September 11, 2018 10:27
chartproxy - proxy a helm repo locally
#!/bin/bash -e
MAIN_REPO="EXTERNAL REPO GOES HERE"
BASEDIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
PORT=${PORT:-8880}
mkdir -p ${CHARTPROXY_STORAGE}
# adapted from https://github.com/helm/chartmuseum/blob/master/scripts/mirror_k8s_repos.sh
update-mirror() {

Keybase proof

I hereby claim:

  • I am cmaher on github.
  • I am cmaher_itbit (https://keybase.io/cmaher_itbit) on keybase.
  • I have a public key whose fingerprint is 7AFA 253B C54F D0FD D5D8 2D40 1721 56F6 6CD7 2227

To claim this, I am signing this object:

@cmaher
cmaher / kill-clickbait.js
Last active December 2, 2017 16:51
tampermonkey script to hide clickbait related articles
// ==UserScript==
// @name kill-clickbait
// @namespace http://tampermonkey.net/
// @version 0.1
// @description Remove clickbait related articles
// @author cmaher
// @match *://*/*
// @grant none
// ==/UserScript==
@cmaher
cmaher / savings.js
Created November 16, 2017 20:19
savings equation
function savings(principal, rate, contributions, years) {
return (principal * ((1 + rate) ** years)) + (contributions * ((((1 + rate) ** years) - 1) / rate))
}
@cmaher
cmaher / hyper-show-hide.ahk
Created October 2, 2017 12:50
AHK script for replacing hyper-summon with WSL
^`::
IfWinExist, Hyper
{
if WinActive("Hyper")
{
Send !{Escape}
}
else
{
@cmaher
cmaher / hoard-model.js
Created January 16, 2015 22:53
Using Hoard with a Model
var cacheControl = new Backbone.Hoard.Control();
var MyModel = Backbone.Model.extend({
url: function () {
return '/my-models/' + this.id;
},
sync: cacheControl.getModelSync()
});
@cmaher
cmaher / es6-backbone-events
Last active August 29, 2015 14:12
Export BackboneEvents as a standalone ES6 module
# assumes GNU Sed
# for OSX: `brew install gnu-sed; alias sed=gsed`
# Known to work with Bacbone 1.1.2
echo " import _ from 'lodash';
var root = {};
var Backbone = {};
var $;
$(sed '/^\s*\/\/\s*Initial Setup\s*$/,/^\s*\/\/\s*Backbone.Model\s*$/{//!b};d' backbone.js)
export default Events;" > backbone.events.js