Skip to content

Instantly share code, notes, and snippets.

@agam
agam / Chroot.sh
Created September 16, 2023 07:41
Simple chroot-er
#/bin/bash
mkdir /home/namespace/box
mkdir /home/namespace/box/bin
mkdir /home/namespace/box/lib
mkdir -p /home/namespace/box/usr/lib
mkdir /home/namespace/box/lib64
mkdir /home/namespace/box/proc
mkdir /home/namespace/box/data
@agam
agam / ciel-lispworks.md
Last active September 7, 2022 07:35
Getting CIEL to work under Lispworks

Works fine in SBCL (though still needed some changes like avoiding fof and a new asdf version; some of that might be specific to the M1 Macbook I'm using)

Lispworks error:

CL-USER 1 > (ql:quickload "ciel")
To load "ciel":
  Load 1 ASDF system:
    ciel
@agam
agam / rebar-lfe.sh
Created April 25, 2022 06:04
Minimal LFE quick-start with Rebar
## Install rebar
$ brew install rebar3
## Create a basic app
$ rebar3 new lfe-main hello-world
## Run it
$ cd hello-world
$ rebar3 lfe run
@agam
agam / pq_copy_demo.go
Created October 27, 2021 08:28
Example of copying a CSV file into Postgres
package main
import (
"database/sql"
"encoding/csv"
"io"
"log"
"os"
"strconv"
@agam
agam / julia_nix_2.sh
Created May 28, 2020 21:35
Julia build errors in Nix (2)
abstractarray (3) | 95.06 | 10.17 | 10.7 | 4644.22 | 1128.55
copy (3) | 4.53 | 0.73 | 16.1 | 163.99 | 1137.33
math (3) | 61.15 | 4.49 | 7.3 | 2922.46 | 1166.40
fastmath (3) | 9.71 | 0.79 | 8.1 | 423.55 | 1172.64
functional (3) | 11.60 | 1.22 | 10.5 | 629.91 | 1186.18
iterators (3) | 66.29 | 8.28 | 12.5 | 3853.52 | 1252.83
operators (3) | 8.79 | 1.07 | 12.2 | 486.14 | 1263.14
path (3) | 4.47 | 0.19 | 4.3 | 96.64 | 1295.82
ccall (3) | 150.80 | 137.32 | 91.1 | 699.45 | 1297.29
parse (3) | 15.78 | 2.03 | 12.9 | 855.21 | 1297.29
@agam
agam / julia_nix_1.sh
Last active May 28, 2020 21:35
Julia install failure on Nix (1)
LINK src/support/libsupport.a
Warning: git information unavailable; versioning information limited
CC src/flisp/flisp.o
In file included from /build/source/usr/include/llvm/IR/IRBuilder.h:19,
from /build/source/src/llvmcalltest.cpp:7:
/build/source/usr/include/llvm/ADT/ArrayRef.h: In instantiation of 'llvm::ArrayRef<T>::ArrayRef(const std::initializer_list<_Tp>&) [with T = llvm::Type*]':
/build/source/src/llvmcalltest.cpp:20:42: required from here
/build/source/usr/include/llvm/ADT/ArrayRef.h:102:37: warning: initializing 'llvm::ArrayRef<llvm::Type*>::Data' from 'std::initializer_list<llvm::Type*>::begin' does not extend the lifetime of the underlying array [-Winit-list-lifetime]
102 | : Data(Vec.begin() == Vec.end() ? (T*)nullptr : Vec.begin()),
Warning: git information unavailable; versioning information limited
@agam
agam / babushka.sh
Created May 28, 2020 06:40
Babashka build failure on Nix
Finished Archiving GRAALVM_UNKNOWN_STAGE1
Building gu.image... [dependencies updated: GRAALVM_UNKNOWN_STAGE1]
env MX_SUBPROCESS_COMMAND_FILE=/build/mx_subprocess_command.hjlpZv GRAAL_PYTHONHOME=/build/mxgitcache/graalpython/graalpython MX_HOME=/nix/store/ir3m6581n7r7h9c0f8xxplvzfnl4gfnv-mx-5.247.1/bin MX_PRIMAR
Y_SUITE_PATH=/build/source/vm MX__SUITEMODEL=sibling \
/build/mxbuild/vm/linux-amd64/GRAALVM_UNKNOWN_STAGE1/graalvm-unknown-19.2.1/jre/lib/svm/bin/native-image --macro:gu-launcher -H:NumberOfThreads=2 -H:Path=/build/mxbuild/vm/linux-amd64/gu.image
[gu:9553] classlist: 4,413.68 ms
[gu:9553] (cap): 3,512.98 ms
[gu:9553] setup: 5,923.23 ms
[gu:9553] (typeflow): 27,842.68 ms
[gu:9553] (objects): 18,776.35 ms
agam@ubuntu-s-2vcpu-4gb-sfo3-01:~$ nix search emacs
warning: using cached results; pass '-u' to update the cache

...

* nixpkgs.emacs (emacs)
  The extensible, customizable GNU text editor
@agam
agam / replace_rest_extension.sh
Last active February 4, 2020 05:40
Shell script with separate function to read and write out while appending to given multi-line section
#INPUT_FILE=/Users/abrahma/tmp/missing.properties
#OUTPUT_FILE=/Users/abrahma/tmp/output1.properties
#EXISTING_FILE=/Users/abrahma/tmp/existing.properties
EXISTING_FILE=/Users/abrahma/tmp/spaces.properties
OUTPUT_FILE=/Users/abrahma/tmp/output.properties
KEY="^\s*rest.extension.classes"
NEWVAL="io.confluent.connect.replicator.monitoring.ReplicatorMonitoringExtension"
@agam
agam / emacsclient.zsh
Last active October 4, 2019 23:34
Convient file-based access to running GUI Emacs (Spacemacs!)
alias e="emacsclient --no-wait --socket-name=/Users/abrahma/.emacs.d/server/server"
# Previous errors about `-error Unknown&_command:` were fixed after upgrading emacsclient to match the Emacs version
# `brew cask install emacsclient` and `brew cask install emacs' worked for me.