Skip to content

Instantly share code, notes, and snippets.

andrewchambers

Block or report user

Report or block andrewchambers

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View output.txt
running suite tester-self-test-suite
✔✔
passed 2/2
View coolpkg.md

Concept for coolpkg

Coolpkg is a new decentralized, time traveling package manager that ...

  • Solves dependency hell.
  • Gives you reproducible builds.
  • Makes it easy to share programs with your friends (or worst enemy, it doesn't care.).
  • Works well with existing tools (docker, various operating systems and more).
  • Is fun to use.
View janetsh
{ stdenv, fetchFromGitHub, janet, pkgconfig, readline80}:
stdenv.mkDerivation rec {
pname = "janetsh";
version = "0.0.1";
src = fetchFromGitHub {
owner = "andrewchambers";
repo = "janetsh";
rev = "72253ce31bee9974a2fee232cce5d049b2ade215";
@andrewchambers
andrewchambers / sysrc
Last active May 28, 2019
Janetsh sysrc nixos
View sysrc
users.extraUsers.ac = {
shell = "${janetsh}/bin/janetsh-posix-wrapper";
};
environment.etc."janetsh.rc".text = ''
(import posixsh)
(def env-blacklist @{"_" true})
(when (not (= "1" (os/getenv "__NIXOS_SET_ENVIRONMENT_DONE")))
View gist:9627b028b76fe376655052bbd13a1939
(set *hist-file* (first (sh/expand "~/.janetsh.hist")))
(def tc
{
# The wrapping \x01 ... \x02 tell readline the surrounded string has zero length.
# Without it we get strange artifacts in the string history.
:bold "\x01\x1b[1m\x02"
:none "\x01\x1b[0m\x02"
})
View errors.md

My observation is that a root cause of an error is special, I usually only care about the first error and the last error in the chain except for logs.

In the end I disliked pkg/errors naming conventions and wrote my own small package.

A typical usage of my package in a server:

@andrewchambers
andrewchambers / errors.md
Created Aug 28, 2018
Error values feedback
View errors.md

In my own code, I use my own error package. My observation is that a root cause of an error is special, most values in the error chain are useless except to preserve line information. Users and debuggers usually only care about the first error and the last error in the chain.

A typical formatting of an error is "Unable to ${TOP_ACTION}: ${ROOT_CAUSE}"

A typical usage of my package is:

@andrewchambers
andrewchambers / gist:1c473fd1595f4fcedbcfc634ee1decb0
Last active Feb 21, 2018
full disk encrypted nixos install
View gist:1c473fd1595f4fcedbcfc634ee1decb0
#! /bin/sh
set -e
set -u
set -x
# configure this!
hostname="nixos"
password="abc123"
diskdev=/dev/sda
@andrewchambers
andrewchambers / notes.txt
Last active Apr 12, 2018
Notes on a new interpreted language
View notes.txt
I have been thinking recently about a set of features that might be
interesting for an interpreted language. Largely I am uninterested in the
syntax for now, just the properties of the language and implementation.
1. Actor model similar to erlang with total isolation of actors except
via message passing. Crashing one actor does not affect other actors
unless they want to be affected.
2. Mutability within an actor, but only immutable objects can be passed
View gist:8118437434738b08d5dc671e7e8bd138
use sys
use std
// XXX move to stdlib
const rename = {from, to
var ret = sys.rename(from, to)
-> ret == 0
}
You can’t perform that action at this time.