Skip to content

Instantly share code, notes, and snippets.

@laser
laser / meow.xml
Created March 27, 2025 17:56
derp
<?xml version="1.0" encoding="UTF-8" standalone="yes"?><Data><Tool><ToolId>1002097</ToolId><Description>milling head</Description><Adapter><AdapterId>2</AdapterId><AdapterPresetter><CES>86</CES><Focus>FocusArea.1</Focus><MsrRangeWidth>3.6</MsrRangeWidth><MsrRangeHeigth>3.6</MsrRangeHeigth></AdapterPresetter></Adapter><Step><Position>1</Position><CES>11</CES><Focus>FocusAutoExternal</Focus><MsrMode>Measure2dCris360</MsrMode><MsrRangeWidth>3.7</MsrRangeWidth><MsrRangeHeight>3.7</MsrRangeHeight><ZNominal>153.607998</ZNominal><XNominal>22.000000</XNominal></Step></Tool></Data>
@laser
laser / 00-usage.ts
Last active October 4, 2024 18:23
Easy TypeScript Decorator for TTL Cache (using isaacs/ttlcache)
import { ServerInferRequest, ServerInferResponses, initContract } from '@ts-rest/core';
import { createExpressEndpoints, initServer } from '@ts-rest/express';
import express from 'express';
import { z } from 'zod';
import { CacheMethod } from '~/util/cache-method';
export const EchoSchema = initContract().router({
echo: {
body: z.object({
call: z.string(),
import json
import pathlib
from datetime import datetime
def key(job_id: str, op: str):
return f"{job_id}-{op}"
if __name__ == "__main__":
@laser
laser / vanilla.js
Last active November 4, 2023 04:01
Socket.IO + Vanilla JS
var request = require('request-json'),
express = require('express'),
app = express(),
http = require('http').Server(app),
io = require('socket.io'),
db = require('mongodb').MongoClient;
///////////////////////////////////////////////////////////
// boilerplate code: ignore
//
@laser
laser / 0a.hs
Last active April 13, 2023 14:06
An Introduction to ADTs and Structural Pattern Matching in TypeScript
data Failable t e = Success t | Failure e
@laser
laser / formatter.rb
Last active November 3, 2022 22:29
A Procfile formatting script, written in Ruby
#!/usr/bin/env ruby
require 'optparse'
def get_procfile_lines
STDIN.read.split("\n")
end
def get_process_type_max_width(lines)
processes = []
@laser
laser / interface.idl
Created April 14, 2014 17:29
03: UserService IDL
// services/user_service/interface.idl
struct UserProperties {
email string
full_name string
phone_number string [optional]
}
struct User extends UserProperties {
id int
@laser
laser / runthis.sh
Created March 31, 2020 18:31
start daemon with custom genesis block
#!/usr/bin/env bash
genesis_miner_addr="t01000"
BASEDIR=$(mktemp -d -t "lotus-interopnet.XXXX")
git clone --branch "testnet/3" https://github.com/filecoin-project/lotus.git "${BASEDIR}/build"
mkdir -p "${BASEDIR}/scripts"
mkdir -p "${BASEDIR}/bin"
@laser
laser / movie.md
Last active November 18, 2020 19:02

Movie Ticket Kata

First, head here to join our Zoom meeting. It will help me following along while you work through the assignment.

What Are We Building?

Write a program that calculates purchase price for movie tickets using any language you like. It should not be a full-blown web app; it can be a simple class or collection of methods invokable by your test suite. We'll provide you with some requirements, test-cases, and even a sample interface - all you have to do is give us some software.

Base Admission Rate

@laser
laser / Notes.md
Last active September 20, 2020 07:43
Cousera - Python Notes

Week 4

Constants

  • Cannot change
  • Examples: 1, 9.12, True, or "Foo"

Variables