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 / or-try.py
Last active May 4, 2022 13:29 — forked from Alir3z4/xapian-virtualenv.sh
install xapian inside virtualenv
sudo apt-get install zlib1g-dev
sudo apt-get install g++
sudo apt-get install uuid-dev
export VENV=$VIRTUAL_ENV
mkdir $VENV/packages && cd $VENV/packages
curl -O http://oligarchy.co.uk/xapian/1.2.18/xapian-core-1.2.18.tar.xz
curl -O http://oligarchy.co.uk/xapian/1.2.18/xapian-bindings-1.2.18.tar.xz
@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 / 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' } }
@lynsei
lynsei / cloudinit.yml
Created November 23, 2021 19:05 — forked from phillhocking/cloudinit.yml
netbox-aws
#cloud-config
packages:
- apt-transport-https
- ca-certificates
- curl
- gnupg-agent
- software-properties-common
- git
# create the docker group
@lynsei
lynsei / bootstrap.sh
Created November 24, 2021 00:40 — forked from SidIcarus/bootstrap.sh
environment bootstrap scripts
#!/bin/bash
# shellcheck disable=1090,1091,2059
# set ENV default value to 'dev''
ENV="${1:-dev}"
# import (source) utility variables and functions
. "$DIR/bootstrap/utils"
# Terminal output to illustrate progress
@lynsei
lynsei / dlg
Created November 25, 2021 13:33 — forked from gpsoft/dlg
How to use `dialog` command in a shell script.
#!/usr/bin/bash
dialog \
--title "Yeah!" \
--msgbox "Test for dialog.\nPress OK." \
7 60
dialog \
--title "Excuse me?" \
--yesno "Are you still there?" \
@lynsei
lynsei / acpi.sh
Created December 3, 2021 05:35 — forked from ldante86/acpi.sh
bash version of acpi
#!/bin/bash -
#
# SCRIPT: aacpi
# AUTHOR: Luciano D. Cecere
# DATE: 2014
#
########################################################################
#
# acpi - show laptop battery information
# Copyright (C) 2014 Luciano D. Cecere <[email protected]>
@lynsei
lynsei / .zshrc
Created December 4, 2021 23:03 — forked from Jimeh87/.zshrc
Mac Setup
# Path to your oh-my-zsh installation.
export ZSH="/Users/jimrennie/.oh-my-zsh"
ZSH_THEME="powerlevel9k/powerlevel9k"
POWERLEVEL9K_MODE="nerdfont-complete"
POWERLEVEL9K_PROMPT_ON_NEWLINE=false
POWERLEVEL9K_RPROMPT_ON_NEWLINE=false