Skip to content

Instantly share code, notes, and snippets.

@fridgerator
fridgerator / instructions.md
Created November 14, 2019 23:48
Auto-renewing Lets Encrypt certificates for Rancher 1.6

Lets Encrypt has removed their ACME V1 api in favor of ACME V2. The Rancher 1.6 catalog entry for Lets Encrypt certificates doesn't support this api. There is a forked version of the repo, however the service has to be created manually instead of from the catalog.

  1. Create a new service, give it a name, use vxcontrol/rancher-letsencrypt:v1.0.0 for the image
  2. In the "Volumes" tab, add a volume /var/lib/rancher:/var/lib/rancher
  3. In the "Command" tab, set the "Console" option to none
  4. Click to add an Environment Variable, and paste the following into the first "Variable" input field.
  • All of the environment variables should auto-fill.
  • Fill in the necessary values
@fridgerator
fridgerator / index.js
Created November 11, 2019 20:06
DevShop bot
const inbox = document.querySelector('#ba')
const backlog = document.querySelector('#dev')
const dev = document.querySelector('#dev0')
const test = document.querySelector('#test')
const done = document.querySelector('#done')
const people = document.querySelector('#people')
let interval
let loop = () => {
;[inbox, backlog, dev, test].forEach(lane => {
@fridgerator
fridgerator / Foo.cc
Created September 27, 2019 13:47
Native node module event emitter
#include "Foo.h"
Nan::Persistent<v8::Function> Foo::constructor;
Foo::Foo () { }
Foo::~Foo () { }
void Foo::Init(v8::Local<v8::Object> exports) {
Nan::HandleScope scope;
@fridgerator
fridgerator / binding.gyp
Last active April 3, 2019 17:01
v8 Boilerplate
{
"targets": [
{
"target_name": "hello",
"sources": [
"src/main.cc",
],
"include_dirs": [
"<!(node -e \"require('nan')\")"
]
@fridgerator
fridgerator / custom_font.c
Created April 1, 2019 16:20
LittlevGL + FreeType
#include "custom_font.h"
int rows = 20;
int load_custom_font(void)
{
printf("load custom font\n");
int error;
error = FT_Init_FreeType(&library);
if (error) {
#define USE_SDL 1
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include "lvgl/lvgl.h"
#include <pango/pangocairo.h>
#if USE_SDL
#include <SDL2/SDL.h>
lv_obj_t *main_container = lv_obj_create(parent, NULL);
lv_obj_set_size(main_container, 800, 480);
cairo_t *layout_context;
cairo_t *render_context;
cairo_surface_t *surface;
unsigned char* surface_data = NULL;
PangoFontDescription *desc;
PangoLayout *layout;
unsigned int *text_width;
#include <ft2build.h>
#include FT_FREETYPE_H
static FT_Library library;
static FT_Face face;
int load_custom_font(void)
{
int error;
error = FT_Init_FreeType(&library);
@fridgerator
fridgerator / crystal_blockchain.cr
Created December 21, 2017 21:59
Simple blockchain in crystal
require "secure_random"
require "openssl"
module Blockchain
extend self
@@blocks = Array(String).new
def init_blockchain
data = SecureRandom.hex(8)
form action="/sign_in" method="post"
.modal-content
.modal-header
button.close type="button" data-dismiss="modal" aria-label="Close"
span aria-hidden="true"
| ×
h4.modal-title Sign in
.modal-body
== csrf_tag
.form-group