Skip to content

Instantly share code, notes, and snippets.

View christian-schulze's full-sized avatar

Christian Schulze christian-schulze

View GitHub Profile

Update

If you're OK in having a node-esm executable, please consider this solution.

#!/usr/bin/env sh
# the /usr/local/bin/node-esm executable
input_file=$1
shift
exec node --input-type=module - $@ <$input_file

Creating standalone ESM-based Node.js scripts on Unix and Windows

Approach:

  1. The file starts with shell code.
  2. That code uses Node.js to execute the file in ESM mode, after it removes the initial non-JavaScript lines.
    • Node.js does not currently have CLI flags for achieving what we do in this step. Therefore, we have to pipe to the node executable.

When editing this file, we want to use the JavaScript mode of our IDE or editor. Therefore, we try to “hide” the shell code from JavaScript as much as possible.

@christian-schulze
christian-schulze / deployment.yml
Created May 12, 2022 23:00
manual (no helm) nfs-subdir-external-provisioner example using two provisioners
apiVersion: apps/v1
kind: Deployment
metadata:
name: nfs-client-provisioner
labels:
app: nfs-client-provisioner
namespace: default
spec:
replicas: 1
strategy:
@christian-schulze
christian-schulze / setupFilesAfterEnv.js
Created August 24, 2021 09:57 — forked from bvaughn/setupFilesAfterEnv.js
Jest config to remove extra console location / formatting noise
import { CustomConsole } from '@jest/console';
function formatter(type, message) {
switch(type) {
case 'error':
return "\x1b[31m" + message + "\x1b[0m";
case 'warn':
return "\x1b[33m" + message + "\x1b[0m";
case 'log':
default:
@christian-schulze
christian-schulze / Hyper.md
Last active August 21, 2021 08:22 — forked from toroidal-code/Hyper.md
Mapping the Hyper key to RALT, RWIN or RCTRL

Mapping the Hyper key to RALT, RWIN or RCTRL

Gnome, Cinnamon, and KDE all use xkb to manage keyboard mappings.

For Gnome, you use gnome-tweak-tool to access all of the xkb options.

I'm working on Ubuntu 21.04 using Gnome 38.8.5, so all of my xkb files are under /usr/share/X11/xkb. Consult your distro's documentation if this is not the case for you.

The first file we're going to be working with is an addition, under symbols in that xkb folder. It should already have a bunch of files like us and dvp etc. We're going to be adding a new file called hyper. So on my computer, this is /usr/share/X11/xkb/symbols/hyper.

@christian-schulze
christian-schulze / .babelrc
Created August 13, 2019 11:09
babel boilerplate
{
"presets": ["@babel/preset-env"]
}
const exception = {
data: {
error: {
type: "Runtime Error",
description: "asdf asdf asdf asdf",
handled: true
},
extension: {
response: {
statusCode: 500,
@christian-schulze
christian-schulze / _decimal.scss
Created February 11, 2017 10:16 — forked from terkel/_decimal.scss
Rounding decimals in Sass
// _decimal.scss | MIT License | gist.github.com/terkel/4373420
// Round a number to specified digits.
//
// @param {Number} $number A number to round
// @param {Number} [$digits:0] Digits to output
// @param {String} [$mode:round] (round|ceil|floor) How to round a number
// @return {Number} A rounded number
// @example
// decimal-round(0.333) => 0

Keybase proof

I hereby claim:

  • I am christian-schulze on github.
  • I am christians (https://keybase.io/christians) on keybase.
  • I have a public key ASDS4X1v__QgFXvi8MhTMfT4mmF2B0Ay2Jg05RUyYFbQ2Qo

To claim this, I am signing this object:

require 'rubygems'
require 'spoon'
Spoon.spawnp 'jruby', *ARGV