Skip to content

Instantly share code, notes, and snippets.

View tbjers's full-sized avatar
🙃

Torgny Bjers tbjers

🙃
View GitHub Profile
@tbjers
tbjers / CSTC40-via.json
Created June 14, 2023 02:30
VIA layout file for CSTC40
{
"name": "CSTC40",
"vendorId": "0x586A",
"productId": "0x0040",
"lighting": "qmk_backlight_rgblight",
"matrix": { "rows": 4, "cols": 12 },
"layouts": {
"keymap": [
[
"0,0",
@tbjers
tbjers / code.py
Created November 25, 2021 05:51 — forked from anecdata/code.py
TileGrid terminalio
import sys
import board
import displayio
import terminalio
display = board.DISPLAY # or equivalent external display library
splash = displayio.Group()
fontx, fonty = terminalio.FONT.get_bounding_box()
@tbjers
tbjers / gpg-ssh-setup.md
Created September 24, 2021 19:15 — forked from mcattarinussi/gpg-ssh-setup.md
A setup guide to use a personal gpg key for ssh authentication

GPG - SSH setup

Generating the master key

Here we create the master key. We want only Certify capability: we use the master key only to create the subkeys, Sign - Encrypt - Authenticate capabilities will be assigned to the subkeys.

Run the following command to start the master key generation process. Select the set your own capabilities creation process (type 8)

  ▶ gpg --full-generate-key --expert

gpg (GnuPG) 2.2.9; Copyright (C) 2018 Free Software Foundation, Inc.

@tbjers
tbjers / instructions.md
Created February 4, 2021 15:40 — forked from douglasmiranda/instructions.md
Add email to Keybase.io PGP Key (Public Key)

Export your public key:

keybase pgp export > keybase-public.key

Export your private key:

keybase pgp export --secret > keybase-private.key
<p style="font-size: 12px; line-height: 18px;">--</p>
<p style="font-size: 12px; line-height: 18px;">
<b>Torgny Bjers</b> | Senior Software Engineer
</p>
<p style="font-size: 12px; line-height: 18px;">
ConsumerTrack, Inc. |
<a href="http://www.consumertrack.com/" target="_blank"
>www.consumertrack.com</a
>
</p>
@tbjers
tbjers / dynamic-inventory.sh
Last active May 29, 2019 05:53
Create dynamic Ansible inventory from Digital Ocean terraform state
#!/bin/sh
# Assuming your terraform files are in ./ and Ansible in deploy/
# this one-liner extracts ipv4_address and groups them under hostname.
# Sample output:
# [my_droplet]
# 192.168.1.1
terraform state pull | jq -r 'def kv: to_entries[] | "\(.value)"; .resources | .[] | select(.type == "digitalocean_droplet") | { "\(.name)": [.instances[].attributes.ipv4_address] } | [to_entries[] | "[\(.key)]", (.value|kv)] | join("\n")' > deploy/hosts
@tbjers
tbjers / controller.js
Created April 17, 2019 21:13
Speed up Lambda invocation by using keep-alive
const AWS = require('aws-sdk');
const https = require('https');
const sslAgent = new https.Agent({
keepAlive: true,
maxSockets: 50,
rejectUnauthorized: true
});
sslAgent.setMaxListeners(0);
@tbjers
tbjers / controller.js
Created April 16, 2019 14:40
Recording Nock objects and saving to disk
// eslint-disable-next-line import/no-extraneous-dependencies
const nock = require('nock');
const fs = require('fs');
const path = require('path');
nock.recorder.rec({
dont_print: true,
output_objects: true
});
@tbjers
tbjers / __tests__-campaigns.test.js
Created October 26, 2017 00:00
Basics of Jest coverage with Typescript
import * as jestPlugin from 'serverless-jest-plugin';
import * as mod from './../handlers/campaigns/handler';
const lambdaWrapper = jestPlugin.lambdaWrapper;
const wrapped = lambdaWrapper.wrap(mod, { handler: 'campaigns' });
describe('λ: campaigns', () => {
beforeAll(done => {
done();
});
Verifying that +torgny is my blockchain ID. https://onename.com/torgny