Skip to content

Instantly share code, notes, and snippets.

#!/usr/bin/env bash
EXAMPLE=$(cat <<EOF
(macrolet ((execute-lambda-at-compile-time-a (l)
\`(quote
,(handler-case (funcall l)
(error (e) (format nil "~a" e)))))
(execute-lambda-at-compile-time-b (l)
\`(quote
#!/usr/bin/env bash
EXAMPLE=$(cat <<EOF
(macrolet ((execute-lambda-at-compile-time-a (l) \`(quote ,(funcall l)))
(execute-lambda-at-compile-time-b (l) \`(quote ,(funcall (eval l))))
(run-example (symbol)
\`(handler-case (,symbol (lambda () 'hello))
(error (e) (format nil "~a" e)))))
(print (list
(run-example funcall)
(defmacro code-generator-caller-1 (code-generator)
`(quote ,(funcall code-generator)))
(defmacro code-generator-caller-2 (code-generator)
`(quote ,(funcall (eval code-generator))))
(defmacro run-example (symbol)
`(,symbol (lambda () 'hello)))
;; (run-example funcall)
#!/usr/bin/env node
(function(){
function aFunction(){
var a = "A1";
let b = "B1";
console.log(`Inside function, BEFORE variable assignments in "inner" lexical scope:\n\t<a: ${a}, b: ${b}>`);
// Prints:
// Inside function, BEFORE variable assignments in "inner" lexical scope:
@emacdona
emacdona / solution.js
Last active September 26, 2021 01:46
#!/usr/bin/env node
function testInputs(f, ...inputs){
inputs.forEach( i =>
console.log(`${i} becomes: ${f(i)}`)
);
}
// Quick and easy solution.
// Problems:
I’ve got a really strange problem that I’ve been trying to get to the bottom of for three days and I’m really stuck. Posting here hoping someone has an idea of where I could look.
I’ve got a Vagrantfile that provisions a minimal ubuntu VM to use as a local Sandbox to test what follows (the production target is EC2 instance in AWS).
I’ve got some Ansible code that I run against that VM to configure it.
I’ve got a script that runs Ansible via a docker container (so that I — and my coworkers — don’t need to install/mange Ansible on our machines.)
Ansible installs (among other things) Jenkins onto the VM. It is preconfigured with all the credentials it needs (to pull from git, to connect to VPNS) and a few default pipelines.
@emacdona
emacdona / co.sh
Created August 20, 2020 18:41
Ever get tired of having to type out branch names when you're trying to switch between local branches? This four line function will prompt you for a number instead (warning: uses zsh function and 'read' builtin syntax; you'll need to modify for bash).
# "checkout". Shows you local git branches and prompts you to select one by ordinal
co() {
echo "Which branch do you want to switch to?"
git branch | cat -n
read "NUM?> "
git checkout $(git branch | head -n $NUM | tail -n 1)
}
@emacdona
emacdona / main.js
Last active November 15, 2018 17:29
// Run this file by typing this at the terminal while in the directory you saved this file to:
// (assuming you called the file 'main.js'
// node main.js
/*********************************************************************************
*
* PART I: Setup
*
*********************************************************************************/
GVM has been detected on your system...
This update will upgrade GVM to SDKMAN!
Do you want to continue with the upgrade? (Y/n)y
Thanks for upgrading to...
#!/usr/bin/perl
my $letters = shift or die "Specify letters";
my @letters = split //, $letters;
my $size = shift or die "Specify count";
open(DICT, "</usr/share/dict/words");
my $words = {};