Skip to content

Instantly share code, notes, and snippets.

View nilium's full-sized avatar
🍉
internal screaming intensifies

Noel nilium

🍉
internal screaming intensifies
View GitHub Profile
function chainfunc(...)
local chain={...}
return function(...)
local first = true
local a,b,c,d,e,f
for i,v in ipairs(chain) do
if first then
result = {v(...)}
first = false
else
@nilium
nilium / NOTES.md
Last active April 10, 2020 20:46
Possible bug in jq

Only occurs when multiplying a string with an interpolation containing a suffix (i.e., the "\n"). Doesn't matter what the suffix is, does not seem to result in any difference for how many bytes are taken from the start of the third duplication.

The third entry onward in a string multiplication is missing 16 bytes, which have been replaced with NULs.

If the interpolation is instead a prefix, nothing incorrect happens.

Using concatenation instead of interpolation also works correctly.

In the second case, if using . in the interpolation instead of tojson, corruption of the string content occurs. If multiplied by 6 or more, the corruption seems to be stable, but doesn't appear to have any rhyme or reason to the content of the 16 bytes.

@nilium
nilium / gen-makefile.rb
Created July 22, 2012 07:45
A simple Makefile generator.
#!/usr/bin/env ruby -w
OS_DIR = /(?i:\/[a-z0-9 \-_\.@]+\.([^\/\\]+))\//
SOURCE_FILE = /(?i:\.(c(c|pp|xx|\+\+)?|m{1,2}))$/
CPP_FILE = /(?i:\.(c(c|pp|xx|\+\+)|mm))$/
INCLUDE_FILE = /^\s*#\s*include\s+(["<])([^">]+)[">]/
EXTENSION = /^\.(.*)$/
# filepath = path to the source file (relative or absolute)
# search_path = paths to search for system includes (relative or absolute)
@nilium
nilium / consul.diff
Created August 13, 2019 23:59
Diff of Consul v1.5.3 between versions of the same tag
v1 is the original v1.5.3 tag, v2 is the changed v1.5.3 tag.
diff -U2 -r v1/consul-1.5.3/vendor/k8s.io/client-go/pkg/version/base.go v2/consul-1.5.3/vendor/k8s.io/client-go/pkg/version/base.go
--- v1/consul-1.5.3/vendor/k8s.io/client-go/pkg/version/base.go 2019-07-25 16:41:17.000000000 -0700
+++ v2/consul-1.5.3/vendor/k8s.io/client-go/pkg/version/base.go 2019-07-25 16:41:17.000000000 -0700
@@ -56,5 +56,5 @@
// companion .gitattributes file containing 'export-subst' in this same
// directory. See also https://git-scm.com/docs/gitattributes
- gitVersion string = "v0.0.0-master+a42ded477c"
+ gitVersion string = "v0.0.0-master+a42ded477"
@nilium
nilium / nomad-tweak
Created August 11, 2019 07:38
Bash script and jq module to make it easier to make small adjustments to Nomad jobs
#!/usr/bin/env bash
# Copyright Noel Cower 2019.
# Distributed under the Boost Software License, Version 1.0.
# (See accompanying file LICENSE_1_0.txt or copy at
# https://www.boost.org/LICENSE_1_0.txt)
# Usage: nomad-tweak <job> [options...] <jq-script>
#
# Options:
# -A, --apply
@nilium
nilium / withtemp
Last active August 10, 2019 19:13
Script to generate an eval-able line to create a temporary file, assign it to a variable, and remove it upon exit.
#!/bin/bash
# Usage: eval "$(withtemp [varname [mktempargs]])
#
# If varname is given, a tempfile is generated, its path assigned to the
# variable $varname, and deleted upon exit. Otherwise, no varname
# becomes 'tempfile' and no arguments are passed to mktemp. Varname is
# not exported or local, but you may evaluate using either
#
# $ eval "local $(withtemp ...)"
#
@nilium
nilium / twitter.json
Created July 23, 2019 02:17
Twitter init-data
{
"keyboardShortcuts": [
{
"name": "Actions",
"description": "Shortcuts for common actions.",
"shortcuts": [
{
"keys": [
"Enter"
],
@nilium
nilium / gltest.rb
Last active June 25, 2019 22:35
Quick GLTest script for Ruby.
#!/usr/bin/env ruby
# This list of requires makes me feel like I'm shilling for some reason.
require 'glfw3' # https://github.com/nilium/ruby-glfw3/
require 'opengl-core' # https://github.com/nilium/ruby-opengl/
require 'snow-data' # https://github.com/nilium/ruby-snowdata/
#
# Creates a GLFW window and yields it and any additional unrecognized arguments
@nilium
nilium / main.go
Last active June 14, 2019 21:15
Example of parsing environment variables and CLI flags using the flag package
package main
import (
"flag"
"log"
"os"
"strings"
"unicode"
)

Build server notes

Any use of "we" in this document is the authorial we because using "I" sounds weird. This is intended to cover building packages under spiff-packages and not necessarily supporting the entirety of void-packages (due to size, complexity, and not having a good idea of every weird quirk of every package in it).

All jobs are intended to run using parametrized nomad tasks. This is not necessarily a requirement but is how it's planned out for now due to the homelab setup.

When building a package, we first need to request a list of all dependencies that package has and fetch all of them

If any package is not already in either the main or build repo, we need to build it, so we have to submit additional jobs to build those packages.