Skip to content

Instantly share code, notes, and snippets.

@Munkkeli
Munkkeli / install.sh
Last active September 6, 2021 22:03
CONSUL_VERSION="1.6.0"
NOMAD_VERSION="0.9.5"
SERVER_IP=$(hostname -I | awk '{print $1}')
sudo apt-get update
sleep 2
sudo apt-get install -y unzip apt-transport-https ca-certificates curl software-properties-common
sleep 2
@ghfields
ghfields / Ubuntu 18.04.1 Rpool Encryption Trial.sh
Last active February 16, 2022 03:36
Change "zpool create" to more feature rich set with improved encryption algorithm
# Run as root
# sudo -i
# Prepare LiveCD Environment
add-apt-repository -y ppa:jonathonf/zfs
apt install -y zfs-dkms
systemctl stop zfs-zed.service
modprobe -r zfs
modprobe zfs
@saschwarz
saschwarz / commands.js
Last active August 31, 2022 07:16
Automated Azure AD login and session token capture to json file for reading by Cypress commands. Heavily inspired by https://gist.github.com/pieterdv/82773fbe036719479d76ab0a4985dc3b
const API = Cypress.env('API');
const headers = {
Authorization: '',
};
Cypress.Commands.add('loginUser', () => {
return cy.readFile('aad-tokens.json')
.then(creds => {
// set auth headers so test setup calls are authorized
#
# Instructions for making hybrid GPT/MBR boot USB thumb drive.
# The Slackware Linux installer will be added to the image as an example,
# however the syslinux configuration can be modified to include any desired
# image.
#
# A USB thumb drive formatted with these instructions was able to
# boot the Slackware Installer on a:
#
# Dell Latitude E6430 in Legacy BIOS mode
@puremourning
puremourning / rfc.md
Last active February 12, 2019 15:25
RFC: Parameter hints popup menu

TL;DR

This RFC proposes introducing a second popup menu in insert mode to display method argument hints, current parameter, etc. similar to a number of IDEs and editors. The proposal is to allow scripts to control this (such as on insert of ( and ) characters) and for it to be non-interractive and not to interfere with insert-mode completion.

The purpose of the RFC is to guage the appetite from Bram and the community for such a feature, and to discuss the design/functional behaviours prior to

@idibidiart
idibidiart / Infrastructure.js
Last active September 10, 2020 00:53 — forked from sebmarkbage/Infrastructure.js
SynchronousAsync.js
const fetch = (url) => {
return new Promise((resolve, reject) => {
setTimeout(() => {
console.log(url)
switch(url.match(/\d[aA-zZ]$/)[0]) {
case "1a":
resolve({name: "Seb"})
// or try this instead:
// reject({error: "something went wrong while fetching " + url})
break;
@sebmarkbage
sebmarkbage / Infrastructure.js
Last active May 2, 2024 03:11
SynchronousAsync.js
let cache = new Map();
let pending = new Map();
function fetchTextSync(url) {
if (cache.has(url)) {
return cache.get(url);
}
if (pending.has(url)) {
throw pending.get(url);
}
@burdandrei
burdandrei / consul-nomad-client-systemd-docker-dnsmasq-userdata-bootstrap.sh
Created December 5, 2017 12:15
UserData Script for bootstrapping Consul and Nomad servers in AWS, connect them with AWS auto discovery and run using systemd
#!/bin/bash
#
# This script is intendent to install both Consul and Nomad clients
# on Ubuntu 16.04 Xenial managed by SystemD
# including docker and DnsMasq for *.service.consul DNS resolving
#
# Script assume that instance is running in AWS and have "ec2:DescribeInstances" permissions in IAM Role
set -x
export TERM=xterm-256color
@yegappan
yegappan / gist:3b50ec9ea86ad4511d3a213ee39f1ee0
Last active April 11, 2023 00:03
Updating a quickfix/location list asynchronously without interfering with another plugin
Vim has many plugins (vim-go, ale, etc.) that use the quickfix/location list
feature. Some of these plugins process the output of an external command and
update the quickfix list asynchronously as the output becomes available.
Updating a quickfix or location list asynchronously opens up the possibility
that two or more plugins may try to update the same quickfix list with
different output. Also when a plugin is updating a quickfix list in the
background, the user may issue a command that creates or updates a quickfix
list. The plugin may then incorrectly use this new list to add the entries.
@developit
developit / *state-machine-component.md
Last active February 6, 2021 00:44
265b lib for building pure functional state machine components. https://github.com/developit/state-machine-component

state-machine-component

A tiny (265 byte) utility to create state machine components using two pure functions.

🔥 JSFiddle Demo

Usage

The API is a single function that accepts 2 pure functions as arguments: