Skip to content

Instantly share code, notes, and snippets.

View nickpascucci's full-sized avatar

Nick Pascucci nickpascucci

View GitHub Profile
@nickpascucci
nickpascucci / indirect.s
Created March 31, 2021 08:23
Porting Jonesforth to RISC-V
/* Test program to evaluate behavior of jalr for indirect threading.
See the comment in jonesforth.s starting after the NEXT macro on line 305.
Basic idea of the test: create an indirect threaded word manually, and use jalr
to jump into it to see what it does in the debugger.
*/
.text
{SANDBOX} [20:37:57] /tmp/ReasonablyTyped [master] > node lib/js/2/cli.js
/tmp/ReasonablyTyped/node_modules/bs-platform/lib/js/belt_Option.js:9
throw new Error("getExn");
^
Error: getExn
at Object.getExn (/tmp/ReasonablyTyped/node_modules/bs-platform/lib/js/belt_Option.js:9:11)
at Object.<anonymous> (/tmp/ReasonablyTyped/lib/js/2/cli.js:90:28)
at Module._compile (module.js:652:30)
at Object.Module._extensions..js (module.js:663:10)
@nickpascucci
nickpascucci / PageHeader.re
Last active June 5, 2018 21:26
Broken ReasonReact component
[%bs.raw {|require('./Header.css')|}];
type state('a) = {selected: 'a};
type action('a) =
| Select('a);
let component = ReasonReact.reducerComponent("PageHeader");
let make = (~orgName, ~productName, ~tabs : list(('a, string)), ~onTabChange : ('a => unit), _children) => {
@nickpascucci
nickpascucci / dev-base.Dockerfile
Last active June 5, 2018 01:41
Dockerfiles for dev images
FROM ndpi/emacs-base
USER root
RUN apt-get update && apt-get install -y \
tmux \
sudo \
&& rm -rf /var/lib/apt/lists/*
COPY sudoers /etc/sudoers.d/90-nick-dev-image
@nickpascucci
nickpascucci / of-completed.scpt
Created July 21, 2017 02:31
AppleScript for sending OmniFocus stats to Beeminder
set ofPerspective to "Today" -- exact Perspective name
set bmAuthToken to "<token>"
set bmUser to "nickpascucci"
set bmGoal to "intentions"
set emailRecipient to "example@gmail.com"
set theDate to date string of (current date)
set reportTitle to "'" & ofPerspective & "' Tasks - " & theDate
-- Vector magnitude/absolute value. This doesn't type check - if you
-- can figure out why, please leave a comment!
magnitude :: Vec (Qu d l n) -> Qu d l n
magnitude (Vec3 x y z) = qSqrt ((qSq x) |+| (qSq y) |+| (qSq z))
-- Couldn't match type ‘d’ with ‘Normalize (d @@+ d) @/ Two’
-- ‘d’ is a rigid type variable bound by the type signature for interactive:IHaskell128.magnitude :: Vec (Qu d l n) -> Qu d l n at :1:14
-- Expected type: Qu d l n
-- Actual type: Qu (Normalize (d @@+ d) @/ Two) l n
-- Relevant bindings include
(ns myproject.parsing
(:import [myproject.parsers.java
JavaLexer JavaParser JavaBaseListener]
[org.antlr.v4.runtime
ANTLRInputStream CommonTokenStream]
[org.antlr.v4.runtime.tree
ParseTree ParseTreeWalker]))
(defn- make-listener []
(proxy [JavaBaseListener] []
@nickpascucci
nickpascucci / parscope.el
Last active December 18, 2015 20:49
A minor mode to highlight the current scope in Lisp-like languages. Doesn't handle strings very well at the moment, but that's in the works.
;;; parscope-mode.el --- Minor mode for showing the current scope in Lisp-like languages.
;; Copyright (C) 2013 Nick Pascucci
;; Author: Nick Pascucci
;; Created: 22 Jun 2013
;; Keywords: tools
;; Version: 0.1
;; URL: https://gist.github.com/nickpascucci/5842987
@nickpascucci
nickpascucci / hpg.py
Last active October 10, 2015 06:08
The Hash Password Generator - a simple, secure password generator system.
#! /usr/bin/env python2.7
# -*- mode: python; fill-column: 80; -*-
"""A simple password generator.
Uses a seed password and an identifier to generate a password. This allows it to
generate unique passwords and recover them easily.
"""
import argparse
@nickpascucci
nickpascucci / project.sh
Created January 1, 2012 00:46
A simple project management script
#! /bin/bash
# Project - Simple project management for Linux developers.
# Use:
# IMPLEMENTED
# project start: start a new project in the project management system.
# project pickup: show the log file up to this point
# project list: show current projects and last log entries.
# project checkpoint: create a new log entry and commit to git.
# project import: add an existing project to the database.