Skip to content

Instantly share code, notes, and snippets.

View xeger's full-sized avatar
🎯
Focusing

Tony Spataro xeger

🎯
Focusing
View GitHub Profile
@xeger
xeger / README.md
Last active May 7, 2024 18:37
NPM Install Packages Hosted in a Private GitHub Repository

Problem Statement

You want to distribute a proprietary NPM package as a GitHub repository "in situ," without publishing it to npmjs.org or even to GitHub Packages. (For example, the package may be subject to constant change, which is not a good fit for the NPM distribution model.)

NPM allows URLs, or even GitHub URLs, as dependencies. When one of these is specified, NPM will perform a shallow clone to install the dependency, and will record the commit ref in your package-lock.json.

However: when the Git repository in question is not public, there is an incompatibility between the way developers, GitHub Actions, and NPM like to access private repositories.

@xeger
xeger / .irbrc
Last active January 25, 2023 12:24
Custom themes for IRB::Color
begin
c = IRB::Color
token_seq_exprs = IRB::Color::const_get(:TOKEN_SEQ_EXPRS)
# TODO: italics; see https://github.com/microsoft/vscode/issues/49236
# TODO: how to customize method names (cyan or bold cyan I think?)
# TODO: what about TOKEN_SEQ_KEYWORDS? do we care?
one_dark = {
on_comment: [c::CLEAR], # needs italics
on_const: [c::YELLOW, c::BOLD],
@xeger
xeger / authz
Last active November 27, 2020 19:59
#! /usr/bin/env sh
echo 'Example rules to evaluate on REPL'
echo '(Ctrl+D to quit REPL)'
echo '================================='
echo 'package authz # do this once at startup'
echo 'allow with input as {"user": "alice", "privilege": "showFunds"}'
echo 'allow with input as {"user": "bob", "privilege": "createDistributions", "path": ["noisy"]}'
exec opa run -w authz.rego authz.yml
@xeger
xeger / bfr.rb
Last active October 6, 2017 17:09
Ballistic rocket passenger transport
#! /usr/bin/env ruby
require 'rubygems'
require 'quantify'
include Math
# Mission parameters:
# 100 people plus baggage
# from New York City to Shanghai
@xeger
xeger / gist:a6263b6854fa77848688
Created June 8, 2015 07:04
Tsiolkovsky burn equation
Derived from http://wiki.kerbalspaceprogram.com/wiki/Tutorial:Advanced_Rocket_Design#Delta-V
Basic idea: compute vessel Isp; mass-flow rate of engines; total mass burn;
derive burn duration using Tsiolkovsky formula.
Implemented, but it doesn't work; it gives bogus duration. Need to debug...
list engines in engs.
local thrustSum is 0.0.
@xeger
xeger / keybase.md
Created January 20, 2015 19:57
keybase.md

Keybase proof

I hereby claim:

  • I am xeger on github.
  • I am xeger (https://keybase.io/xeger) on keybase.
  • I have a public key whose fingerprint is 94EA FA42 2F0D 3705 BB1C 6B8B E03C E5FE FEA6 2420

To claim this, I am signing this object:

---
- !seq:Victim
- one
- two
- !map:Victim
one: uno
two: due
- !ruby/array:Victim
- one
- two
# Send callbacks of this type after a commit.
# We push a new variable holder on each record, then pop it off, which avoids
# an infinite loop whereby an on_commit callback makes a new transaction
# (like in creating a BackgrounDRb record)
def self.callback(crud_method, &block)
record_method = @@record_methods[crud_method]
callback_method = @@callback_methods[crud_method]
committed_records = send(record_method)
unless committed_records.empty?