Skip to content

Instantly share code, notes, and snippets.

View zachallaun's full-sized avatar

Zach Allaun zachallaun

View GitHub Profile
@zachallaun
zachallaun / tool-change-fixed-loc.txt
Last active January 8, 2024 20:49
A cncjs macro for fixed-location tool changes (WIP)
; This macro allows you to use a fixed machine location for a tool change and probe. It works by
; probing twice, once to capture the position of the tool you're changing away from, and again to
; set the adjusted WCS offset of the tool you're changing to.
; Using the macro in practice:
; 1) Insert an M6 tool change command in your program, which will pause cncjs and allow you to
; execute this macro.
; 2) The router retracts to a safe height and moves to a pre-defined location for tool changes and
; probing, then pauses.
; 3) Turn off your router, set up your probe, and continue. This will probe to capture the position
// V1
var cache = {};
function paths(rights, downs) {
var key = rights + ',' + downs;
if (cache[key]) return cache[key];
if (rights === 0 || downs === 0) {
return 1;
{
"description": "The settings in this file are persisted server-side. This file is generated automatically. Editing it is not recommended. Modify SettingsToPersist.json to specify which settings are persisted.",
"files": [
{
"name": "Game.cfg",
"sections": [
{
"name": "Chat",
"settings": [
{
@zachallaun
zachallaun / .md
Last active May 2, 2021 06:15
Git Q&A

Title: A bit beyond Git basics: Q&A Date: 2013-10-04

Q: How do I create a new branch?

git branch <my-branch>

This creates a new branch that points to whichever commit you're currently on. Remember though that it doesn't change your current branch – it only creates a new one.

Q: How do I switch to another branch?

@zachallaun
zachallaun / coro.js
Last active August 29, 2015 14:22 — forked from cqfd/coro.js
// Run with `node --harmony coro.js`
"use strict";
const Promise = require('bluebird');
// Takes a function*, `g`, that yields promises.
// Returns a promise that resolves to `g`'s eventual return value.
var coro = function(gStar) {
const pending = Promise.pending();
@zachallaun
zachallaun / todobot.py
Created November 7, 2014 19:36
Zulip TODO bot
import zulip
import os
import json
client = zulip.Client(config_file='.config', verbose=True)
class TodoManager(object):
def __init__(self, client):
self.client = client
self.todo_file = ".todos"

cljs/js interop

Node.js require

var request = require('request');
(ns ...
@zachallaun
zachallaun / git-questions.md
Last active December 24, 2015 14:49
A series of questions that someone might ask if they wanted to learn more about git.

A bit beyond git basics: Q&A edition

Questions:

  • How do I create a new branch?
  • How do I switch to another branch?
  • How do I create and switch to a new branch in a single command?
  • I've made whatever changes I want on my new branch. How do I merge these changes back into master?
  • After merging, git told me that I made a "fast-forward merge." What does that mean?
  • After merging, git told me that there were auto-merge conflicts. What does that mean and how do I fix it?
@zachallaun
zachallaun / protocols.js
Last active December 19, 2015 02:19
Kinda Clojure-like protocols
// Possibly wacky and useless protocol experiment
var mapObj = function(obj, fn) {
var ret = {}
for (var k in obj) {
var temp = fn(k, obj[k])
ret[temp[0]] = temp[1]
}
return ret
}
@zachallaun
zachallaun / lazy.js
Last active December 18, 2015 23:09
Toy lazy sequences
// LazySeq(head, tailthunk) -> more to go
// LazySeq(head, new Empty) -> end of sequence
function LazySeq(head, tailthunk) {
this.head = head
this.tail = tailthunk
}
function Empty() {}
var empty = new Empty