Skip to content

Instantly share code, notes, and snippets.

View clarkritchie's full-sized avatar
🫡
I prefer dashes to underscores

Clark Ritchie clarkritchie

🫡
I prefer dashes to underscores
View GitHub Profile
@clarkritchie
clarkritchie / setup_rds_postgis.sql
Created February 20, 2019 20:00 — forked from matthewberryman/setup_rds_postgis.sql
Setup postgis in Amazon RDS
-- taken from http://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/Appendix.PostgreSQL.CommonDBATasks.html#Appendix.PostgreSQL.CommonDBATasks.PostGIS
create extension postgis;
create extension fuzzystrmatch;
create extension postgis_tiger_geocoder;
create extension postgis_topology;
alter schema tiger owner to rds_superuser;
alter schema topology owner to rds_superuser;
CREATE FUNCTION exec(text) returns text language plpgsql volatile AS $f$ BEGIN EXECUTE $1; RETURN $1; END; $f$;
@clarkritchie
clarkritchie / aws-ec2-redis-cli.md
Created July 27, 2020 20:56 — forked from paladini/aws-ec2-redis-cli.md
AWS redis-cli without redis server on AWS EC2

Setup redis-cli without the whole Redis Server on AWS EC2

This fast tutorial will teach you how to install redis-clion AWS EC2 without having to install the whole Redis Server. Firstly, SSH into your EC2 instance and run the following command:

$ sudo yum install gcc

This may return an "already installed" message, but that's OK. After that, just run:

$ wget http://download.redis.io/redis-stable.tar.gz && tar xvzf redis-stable.tar.gz && cd redis-stable && make && sudo cp src/redis-cli /usr/local/bin/ && sudo chmod 755 /usr/local/bin/redis-cli

1 of 4, Get jobs

  • GET /jobTemplates/<monitor_id>/jobs
{
    "meta": {
        "model": "job",
        "action": "find",
        "populate": false,
// You can edit this code!
// Click here and start typing.
package main
import (
"fmt"
"net/mail"
"strings"
)

Encode struct to JSON

type FruitBasket struct {
    Name    string
    Fruit   []string
    Id      int64  `json:"ref"`
    private string // An unexported field is not encoded.
    Created time.Time
}
package main
// Simple example of a lambda SQS processor
import (
"context"
"github.com/aws/aws-lambda-go/events"
"github.com/aws/aws-lambda-go/lambda"
"github.com/aws/aws-sdk-go-v2/service/cloudwatchevents"
"github.com/rs/zerolog"
@clarkritchie
clarkritchie / s3.sh
Last active July 27, 2023 20:19
s3 list, copy, delete
#!/usr/bin/env bash
# quick and dirty script to
# - list buckets matching
# - copy buckets matching
# - remove buckets matching
SEARCH=${1}
ACTION=${2:-"ls"}
if [ -z ${SEARCH} ]; then
name: hello-world
on:
push:
branches-ignore:
- main
workflow_dispatch:
inputs:
environment:
description: 'To what environment?'
type: choice
@clarkritchie
clarkritchie / secret.yml
Created October 25, 2023 14:54
Print GitHub Secret
# Crazy trick to make GHA show you the value of a secret
- name: Print secret value
env:
FOO_VAL: ${{ secrets.FOO }}
run: |
import os
data = open("file", "w")
for q in (os.getenv("FOO_VAL")):
print(q)
data.write(q)
@clarkritchie
clarkritchie / sort-1pw.sh
Last active May 30, 2024 21:47
Sort a 1 password secure note
#!/usr/bin/env bash
# Use this script to:
# - export a secure note
# - sort it A-Z
# - update the note with the sorted version
# There isn't a lot of error checking, so be careful
# Note use of gsed (GNU sed) -- which is not the BSD sed that Apple ships with OS/X
#