Skip to content

Instantly share code, notes, and snippets.

View lynsei's full-sized avatar
:octocat:
Huzzah!

Lynsei lynsei

:octocat:
Huzzah!
View GitHub Profile
@lynsei
lynsei / Caching multi-stage builds in GA.md
Created October 10, 2021 21:05 — forked from UrsaDK/Caching multi-stage builds in GA.md
Speed up your multistage builds in GitHub Actions

Caching multi-stage builds in GitHub Actions

Caching Docker builds in GitHub Actions is an excellent article by @dtinth which analyses various strategies for speeding up builds in GitHub Actions. The upshot of the article is a fairly decisive conclusion that the best two ways to improve build times are:

  1. Build images via a standard docker build command, while using GitHub Packages' Docker registry as a cache = Longer initial build but fastest re-build times.

  2. Build your images via docker integrated BuildKit (DOCKER_BUILDKIT=1 docker build), while using a local registry and actions/cache to persist build caches = Fastest initial build but slightly longer re-build times.

The problem

@lynsei
lynsei / Makefile
Created October 10, 2021 21:14 — forked from mpneuried/Makefile
Simple Makefile to build, run, tag and publish a docker containier to AWS-ECR
# import config.
# You can change the default config with `make cnf="config_special.env" build`
cnf ?= config.env
include $(cnf)
export $(shell sed 's/=.*//' $(cnf))
# import deploy config
# You can change the default deploy config with `make cnf="deploy_special.env" release`
dpl ?= deploy.env
include $(dpl)
@lynsei
lynsei / plugin-name.umd-module.js
Created November 15, 2021 02:40
This is a UMS Plugin beingn created for jQuery, following the UMD spec here: https://github.com/umdjs/umd
// Uses CommonJS, AMD or browser globals to create a jQuery plugin.
(function (factory) {
if (typeof define === 'function' && define.amd) {
// AMD. Register as an anonymous module.
define(['jquery'], factory);
} else if (typeof module === 'object' && module.exports) {
// Node/CommonJS
module.exports = function( root, jQuery ) {
if ( jQuery === undefined ) {
@lynsei
lynsei / test.md
Created November 15, 2021 10:29
test

test

@lynsei
lynsei / protobuf,proto3
Created November 15, 2021 20:43
protocol buffer example
syntax = "proto3";
// Package pb provides the protobuf definition of LLB: low-level builder instruction.
// LLB is DAG-structured; Op represents a vertex, and Definition represents a graph.
package pb;
import "github.com/gogo/protobuf/gogoproto/gogo.proto";
option (gogoproto.stable_marshaler_all) = true;
@lynsei
lynsei / keybase.md
Created November 16, 2021 15:40
I am lynsei on github.

Keybase proof

I hereby claim:

  • I am lynsei on github.
  • I am lynsei (https://keybase.io/lynsei) on keybase.
  • I have a public key ASCfJHPBjB-l1vf6NSJFE1rhWWzYsVJg0VZWtWmFSqqZZQo

To claim this, I am signing this object:

@lynsei
lynsei / next.js
Created November 16, 2021 16:57
next.js > cryptographic implementation for comparison to some other operatiuons I'm doing with crypto
import type { NextRequest } from 'next/server'
export async function middleware(req: NextRequest) {
// https://developer.mozilla.org/en-US/docs/Web/API/Crypto/subtle
const plainText = 'Hello from the Edge!'
const password = 'hunter2'
const ptUtf8 = new TextEncoder().encode(plainText)
const pwUtf8 = new TextEncoder().encode(password)
const pwHash = await crypto.subtle.digest('SHA-256', pwUtf8)
@lynsei
lynsei / encryption.libsodium.cleanse.process.php
Last active February 2, 2022 03:32
[get.minted.libsodium - Retrieves the Mint.ini file] that is evaluated in Node and parsed as INI for use in locating the assets needed for #Cryptomint #Decryption #IPFS, #DNS, #PKEY, etc.
# Ḻʸⁿˢ
# serverless emulation tools for:
# /.data.cleansing <<< foolish input device permutations
# /.pkg.singleton <<< I used sift for roughly 10 years in high-traffic portal spaces
#
# .RIE
# /.RIC
# /.AWS.Serverless
# /.Lambda
# /+?.Twilio.Flex.Functions
@lynsei
lynsei / Sequelize-Step-by-Step.md
Last active November 22, 2021 16:06 — forked from zcaceres/Sequelize-Step-by-Step.md
#sequelize #orm #nodejs #es #javascript #graphql

Sequelize: Step-By-Step

Sequelize is a powerful library in Javascript that makes it easy to manage a SQL database. Sequelize can layer over different protocols, but here we'll use PostgreSQL. At its core, Sequelize is an Object-Relational Mapper – meaning that it maps an object syntax onto our database schemas. Sequelize uses Node.JS and Javascript's object syntax to accomplish its mapping.

Under the hood, Sequelize used with PostgreSQL is several layers removed from our actual database:

  1. First, we write our Sequelize, using Javascript objects to mimic the structure of our database tables.
  2. Sequelize creates a SQL string and passes it to a lower-level library called pg (PostgreSQL).
  3. pg connects to your PostgreSQL database and queries it or transforms its data.
  4. pg passes the data back to Sequelize, which parses and returns that data as a Javascript object.
@lynsei
lynsei / AssociativeReader.js
Created November 23, 2021 16:44 — forked from twasink/AssociativeReader.js
ExtJS has some really nice support out of the box for converting JSON data to model objects. However, it only supports array-based associations, and doesn't support maps/associative arrays. The AssociativeReader - included here, along with two demo models and sample data - provides a way to do that.
/**
* A variant of the JSON reader. Instead of reading arrays, where each record in the array field
* has an 'id' property, it reads objects - aka associative arrays. The key of the entry will be the
* array.
*
* So where the JSON reader would like data like this:
* [ { id: '1', property: 'foo' }, { id: '2', property: 'bar' } ]
*
* the associative reader likes data like this:
* { '1': { property: 'foo' }, '2': { property: 'bar' } }