Skip to content

Instantly share code, notes, and snippets.

@acumenix
acumenix / demo.ts
Created December 23, 2024 01:15 — forked from vedantroy/demo.ts
SQLite-backed key-value store with JS-like object manipulation and automatic JSON serialization.
import Database from 'better-sqlite3';
import { createDatabaseClient } from './proxy.ts';
// 1) Create an in-memory DB and your table(s).
const db = new Database(':memory:');
db.exec(`
CREATE TABLE users (
id TEXT PRIMARY KEY,
data JSON
);
@acumenix
acumenix / git-commit-template.md
Created January 12, 2022 21:42 — forked from lisawolderiksen/git-commit-template.md
Use a Git commit message template to write better commit messages

Using Git Commit Message Templates to Write Better Commit Messages

One of my colleagues shared an article on writing (good) Git commit messages today: How to Write a Git Commit Message. This excellent article explains why good Git commit messages are important, and explains what constitutes a good commit message. I wholeheartedly agree with what @cbeams writes in his article. (Have you read it yet? If not, go read it now. I'll wait.) It's sensible stuff. So I decided to start following the

@acumenix
acumenix / aws-ebs-ec2-howtos.md
Created October 11, 2021 06:21 — forked from holmberd/aws-ebs-ec2-howtos.md
Attaching and Mounting EBS Volume to an EC2 Instance

Attaching and Mounting EBS Volume to EC2 Instance

Create

  • Create new EBS Volume in the correct Availability Zone
  • Attach new EBS Volume to EC2 Instance

Mount

  • Check filesystem type (ext4) sudo file -s /dev/xvd*
  • Find new disk sudo fdisk -l
  • Create filesystem sudo mkfs -t ext4 /dev/xvdf
@acumenix
acumenix / vault-deployment-guide.md
Created September 29, 2021 05:29
Vault Deployment Guide

Vault Deployment Guide

This deployment guide covers the steps required to install and configure a single HashiCorp Vault cluster as defined in the Vault Reference Architecture.

Below are instructions for installing and configuring Vault on Linux hosts running the systemd system and service manager.

Reference Material

This deployment guide is designed to work in combination with the Vault Reference Architecture and Consul Deployment Guide. Although not a strict requirement to follow the Vault Reference Architecture, please ensure you are familiar with the overall architecture design; for example installing Vault on multiple physical or virtual (with correct anti-affinity) hosts for high-availability and using Consul for the HA and storage backend.

@acumenix
acumenix / main.workflow
Created September 4, 2021 04:00 — forked from pahud/main.workflow
Github Actions with Amazon EKS CI/CD
workflow "Demo workflow" {
on = "push"
resolves = ["SNS Notification"]
}
action "Build Image" {
uses = "actions/docker/cli@c08a5fc9e0286844156fefff2c141072048141f6"
runs = ["/bin/sh", "-c", "docker build -t $IMAGE_URI ."]
env = {
IMAGE_URI = "xxxxxxxx.dkr.ecr.ap-northeast-1.amazonaws.com/github-action-demo:latest"
@acumenix
acumenix / Get-EtwTraceProvider.ps1
Created May 4, 2021 22:55 — forked from guitarrapc/Get-EtwTraceProvider.ps1
ETW (Event Tracing for Windows) Providers and their GUIDs for Windows 10 x64
#Requires -RunAsAdministrator
#Requires -Version 5.0
# requires Windows 10
Get-EtwTraceProvider | Select-Object SessionName, Guid | sort SessionName
# as Markdown
<#
#Requires -RunAsAdministrator
$result = Get-EtwTraceProvider | sort SessionName
$result | %{"|Name|GUID|";"|----|----|";}{"|$($_.SessionName)|$($_.Guid)|"}
#>
  • Use curl to get the JSON response for the latest release
  • Use grep to find the line containing file URL
  • Use cut and tr to extract the URL
  • Use wget to download it
curl -s https://api.github.com/repos/jgm/pandoc/releases/latest \
| grep "browser_download_url.*deb" \
| cut -d : -f 2,3 \
| tr -d \" \
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@acumenix
acumenix / query_github_audit_log.graphql
Created February 22, 2021 23:17 — forked from jonico/query_github_audit_log.graphql
How to query GitHub's audit log with GraphQL
query {
organization(login: "se-saml") {
auditLog(first: 50) {
edges {
node {
... on RepositoryAuditEntryData {
repository {
name
}
}
@acumenix
acumenix / script-template.sh
Created December 15, 2020 22:33 — forked from m-radzikowski/script-template.sh
Minimal safe Bash script template - see the article with full description: https://betterdev.blog/minimal-safe-bash-script-template/
#!/usr/bin/env bash
set -Eeuo pipefail
trap cleanup SIGINT SIGTERM ERR EXIT
script_dir=$(cd "$(dirname "${BASH_SOURCE[0]}")" &>/dev/null && pwd -P)
usage() {
cat <<EOF
Usage: $(basename "${BASH_SOURCE[0]}") [-h] [-v] [-f] -p param_value arg1 [arg2...]