Skip to content

Instantly share code, notes, and snippets.

View lf94's full-sized avatar
🏔️
Hey how's it going

49fl lf94

🏔️
Hey how's it going
View GitHub Profile
@marcus7070
marcus7070 / cq-internal-example.md
Last active January 30, 2023 23:15
CQ internals example

To see a bit more about how the internals of CadQuery work, let's mokeypatch some more verbose string represenations and create a simple model.

import cadquery as cq


def _ctx_str(self):
    return (
        f"CQContext object with id: {id(self)}\n"
        + f"    pendingWires: {self.pendingWires}\n"
@thehans
thehans / phillips.scad
Created February 26, 2021 18:41
OpenSCAD model for Phillips screwdriver
$fs=0.2;
$fa=0.2;
headNum = 2;
phillipsDrive(headNum);
//phillipsDemo(headNum);
module phillipsDemo(num) {
difference() {
// Propositional logic implemenation
const True = a => b => a;
const False = a => b => b;
const If = x => x;
const Not = a => a(False)(True);
const And = a => b => a(True)(False)(b(True)(False))(False);
const Or = a => b => a(True)(b(True)(False));
const Xor = a => b => And(Or(a)(b))(Not(And(a)(b)));
// SKI calculus implementation
@eatonphil
eatonphil / getreq.sml
Created February 27, 2016 22:59
Example of HTTP GET request in SML
(*
* Tested on Poly/ML.
* Usage:
* $ polyc getreq.sml
* $ ./a.out
*)
exception E of string
fun request domain path =
@kevincennis
kevincennis / v8.md
Last active March 2, 2024 21:50
V8 Installation and d8 shell usage

Installing V8 on a Mac

Prerequisites

  • Install Xcode (Avaliable on the Mac App Store)
  • Install Xcode Command Line Tools (Preferences > Downloads)
  • Install depot_tools
    • $ git clone https://chromium.googlesource.com/chromium/tools/depot_tools.git
    • $ nano ~/.zshrc
    • Add path=('/path/to/depot_tools' $path)
@methodin
methodin / viterbi.js
Created January 7, 2012 21:59
Viterbi
// Viterbi algorithm for finding hidden relationships
function Viterbi(data) {
var V = [{}];
var path = {};
// Initialize base cases (t == 0)
for(var i=0;i<data.states.length;i++) {
var state = data.states[i];
V[0][state] = data.start_probability[state] * data.emission_probability[state][data.observations[0]];
path[state] = [state];
@rsvp
rsvp / noise.sh
Last active April 18, 2024 14:18
noise : relaxing ambient Brown noise generator (cf. white noise) | Linux bash script using sox | CogSci notes
#!/usr/bin/env bash
# bash 4.1.5(1) Linux Ubuntu 10.04 Date : 2019-01-02
#
# _______________| noise : ambient Brown noise generator (cf. white noise).
#
# Usage: noise [minutes=59] [band-pass freq center=1786] [wave]
# ^minutes can be any positive integer.
# Command "noise 1" will display peak-level meter.
#
# Dependencies: play (from sox package)