Skip to content

Instantly share code, notes, and snippets.

View jason-riddle's full-sized avatar

Jason Riddle jason-riddle

View GitHub Profile
locals {
drupal7sites = [
"sfdbi-7.99",
]
drupal8sites = [
"dpa-8.00",
]
}
# https://github.com/jason-riddle/amazon-bedrock-kendra-lex-chatbot
variable "lambda_image" {
description = "The Lambda container image to use in the stack"
type = string
default = "foo"
# default = "${ACCOUNT_ID}.dkr.ecr.${STACK_REGION}.amazonaws.com/${CF_STACK_NAME}:latest"
}
resource "aws_kendra_index" "kendra_index" {
[
{
"userId": 39490,
"orderId": 2782,
"createdAt": "2019-09-09T14:34:56.972Z",
"updatedAt": "2022-05-07T11:47:15.932Z",
"is_nft": false
},
{
"userId": 29873,
@jason-riddle
jason-riddle / README.md
Created March 15, 2022 04:47 — forked from mosquito/README.md
Add doker-compose as a systemd unit

Docker compose as a systemd unit

Create file /etc/systemd/system/docker-compose@.service. SystemD calling binaries using an absolute path. In my case is prefixed by /usr/local/bin, you should use paths specific for your environment.

[Unit]
Description=%i service with docker compose
Requires=docker.service
After=docker.service
@jason-riddle
jason-riddle / keytool_guide.sh
Last active October 22, 2019 19:19
Examples using keytool #keytool
# List certs in keystore
keytool -list -v -keystore /etc/ssl/certs/java/cacerts
# Grep for a specific certificate
echo -n 'changeit' | keytool -list -keystore /etc/ssl/certs/java/cacerts 2>/dev/null | grep -B1 -i 01:18
@jason-riddle
jason-riddle / dmesg_to_utc.sh
Last active October 21, 2019 01:58
Convert dmesg timestamps to UTC format
#!/bin/bash
# Translate dmesg timestamps to human readable format
# desired date format
date_format="%Y-%m-%dT%H:%M:%SZ"
# [ 3.469072] EXT4-fs (xvda1): mounted filesystem with ordered data mode. Opts: (null)
# [ 3.483769] dracut: Remounting /dev/disk/by-label/\x2f with -o noatime,ro
# [ 3.495019] EXT4-fs (xvda1): mounted filesystem with ordered data mode. Opts: (null)
# [ 3.506417] dracut: Mounted root filesystem /dev/xvda1
@jason-riddle
jason-riddle / curl_examples.sh
Created October 21, 2019 01:39
Examples for Curl #snippet #complete
# Robust curl command to retry, timeout, and save the output to a file
curl --silent --show-error \
--location --max-redirs 3 \
--retry 3 --retry-connrefused --retry-delay 2 \
--max-time 30 \
"$url"
@jason-riddle
jason-riddle / gist:d2bf6de8b25a70c05a6570232da9d0c9
Last active October 21, 2019 00:44
Snippet using tcpdump to listen on an http port #snippet #complete
# Ref: https://github.com/SergK/cheatsheat-tcpdump/blob/master/tcpdump_advanced_filters.txt
# Ref: http://edoceo.com/cli/tcpdump
HTTP_PORT="8444"
HTTP_FILTER="(((ip[2:2] - ((ip[0]&0xf)<<2)) - ((tcp[12]&0xf0)>>2)) != 0)"
tcpdump -i any -s 0 -A "tcp port $HTTP_PORT and $HTTP_FILTER"
@jason-riddle
jason-riddle / maxProfit.py
Last active October 21, 2019 00:40
Interview Practice #interviewing #complete
#!/usr/bin/env python3
"""
I have an ordered historical list of daily prices of quizlet coin - the hot new cryptocurrency.
[100, 50, 120, 100, 300, 250, 1]
What is the best profit I could have made from 1 purchase and 1 sale of Quizlet Coin?
cryptsetup luksOpen /dev/nvme0n1p2 cryptkey
cryptsetup luksOpen --key-file=/dev/mapper/cryptkey /dev/nvme0n1p3 cryptswap
cryptsetup luksOpen --key-file=/dev/mapper/cryptkey /dev/nvme0n1p4 cryptroot
#+END_SRC
Then for a not fun bit, matching entries in =/dev/disk/by-uuid/= to
the partitions we want to mount where. Running ~ls -l
/dev/disk/by-uuid/~ shows which devices have which UUIDs. To determine
what =dm-1= and =dm2=, I ran ~ls -la /dev/mapper~: