Skip to content

Instantly share code, notes, and snippets.

@tomconte
tomconte / containerd-certificate-ds.yaml
Last active July 26, 2024 08:47
This is a Kubernetes DaemonSet definition that will install a custom certificate on the nodes and restart containerd. This is useful if your private registry is protected using a self-signed certificate. Not tested in production.
apiVersion: v1
kind: ConfigMap
metadata:
name: trusted-ca
namespace: kube-system
data:
ca.crt: |+
-----BEGIN CERTIFICATE-----
MIIFkTCCA3mgAwIBAgIUCXaMcLg8teiGZ7o0dIQRIOdHEA8wDQYJKoZIhvcNAQEL
BQAweDELMAkGA1UEBhMCRlIxDDAKBgNVBAgMA04vQTEMMAoGA1UEBwwDTi9BMSAw
#!/bin/bash
GREEN="\u001b[32m"
RED="\u001b[31m"
NC="\u001b[0m"
URL=https://api.coinmarketcap.com/v1/ticker/?limit=50
FAV="\"ETH\", \"BTC\", \"BCH\""
JQ=' def pad(s; n): (n - (s|length)) * " ";
def lpad(s; n): pad(s; n) + s;
def rpad(s; n): s + pad(s;n);
def color(s): if (s|tonumber < 0) then "'$RED'" else "'$GREEN'" end;
@donpdonp
donpdonp / .coinfavs
Last active January 17, 2018 00:01
coinmarketcap cli display
"DOGE", "ETH", "QTUM", "BTC"
@ljharb
ljharb / array_iteration_thoughts.md
Last active July 25, 2024 03:38
Array iteration methods summarized

Array Iteration

https://gist.github.com/ljharb/58faf1cfcb4e6808f74aae4ef7944cff

While attempting to explain JavaScript's reduce method on arrays, conceptually, I came up with the following - hopefully it's helpful; happy to tweak it if anyone has suggestions.

Intro

JavaScript Arrays have lots of built in methods on their prototype. Some of them mutate - ie, they change the underlying array in-place. Luckily, most of them do not - they instead return an entirely distinct array. Since arrays are conceptually a contiguous list of items, it helps code clarity and maintainability a lot to be able to operate on them in a "functional" way. (I'll also insist on referring to an array as a "list" - although in some languages, List is a native data type, in JS and this post, I'm referring to the concept. Everywhere I use the word "list" you can assume I'm talking about a JS Array) This means, to perform a single operation on the list as a whole ("atomically"), and to return a new list - thus making it mu

@remarkablemark
remarkablemark / README.md
Last active June 8, 2024 21:48
Classes - ES5 vs ES6

JavaScript Classes - ES5 vs ES6

An example that shows the difference between creating a JavaScript class and subclass in ES5 and ES6.

Reference

@donpdonp
donpdonp / multco-bridge.js
Last active August 6, 2017 18:34
gluon multco bridges
(function() {
setup()
// descriptor
return {name:"multco-bridges"}
})
var bridges = {}
var cache_date
function setup() {
@maximilian-lindsey
maximilian-lindsey / express_in_electron.md
Last active March 29, 2024 22:46
How to run Express inside an Electron app

How to run Express inside an Electron app

You can run your Express app very easily inside your Electron app.

All you need to do is to:

  • place all the files of your Express app inside a new app folder in your_electron_app\resources\app
  • reconfigure the app.js file
  • refactor some relative pathes in your Express app
@nivv
nivv / PHP 7 - Installing imagick on Ubuntu 14.04.md
Last active November 28, 2021 11:38
Guide - Enable imagick on PHP7

Guide

Note The extension Imagick is now included in Ondrej's PPA. All you need to do now is $ sudo apt-get install php-imagick, and you're done. I'll keep the guide here because a lot of it is still true for other extensions

======

I've installed PHP7 via Ondrej's PPA. He maintains these PPA's on his free time, consider donating

Install dependencies

@xrstf
xrstf / letsencrypt.md
Last active April 18, 2023 05:01
Let's Encrypt on Ubuntu 14.04, nginx with webroot auth

Let's Encrypt on Ubuntu 14.04, nginx with webroot auth

This document details how I setup LE on my server. Firstly, install the client as described on http://letsencrypt.readthedocs.org/en/latest/using.html and make sure you can execute it. I put it in /root/letsencrypt.

As it is not possible to change the ports used for the standalone authenticator and I already have a nginx running on port 80/443, I opted to use the webroot method for each of my domains (note that LE does not issue wildcard certificates by design, so you probably want to get a cert for www.example.com and example.com).

Configuration

For this, I placed config files into etc/letsencrypt/configs, named after <domain>.conf. The files are simple:

@jaawerth
jaawerth / promise-series.js
Last active September 4, 2018 21:07
Run a list of functions in series, returning a pjromise that resolves to an array of results.
'use strict';
/*
* run promises in sequence, return an array of results.
* Returns a promise that resolves to an array of results, where funcs[i]() -> results[i]
*/
function asyncSeries(...funcs) {
return aggregate([], funcs);
}