Skip to content

Instantly share code, notes, and snippets.

@alexdlaird
alexdlaird / 1_ServerlessSMSRaffle.md
Last active September 11, 2020 00:47
Serverless SMS raffle powered by Twilio and AWS

Serverless SMS Raffle

Create a new Role from a Policy with the following permissions:

{
    "Version": "2012-10-17",
    "Statement": [
        {
 "Effect": "Allow",
@4410287
4410287 / postgres-backup.sh
Created January 9, 2019 16:32
Shell script for daily postgres database backup with basic archiving.
#!/bin/bash
# Written 2018-11-15 by 4410287
# This script will create a backup file of a postgres database and compress it. It is capable of access a local or remote server to pull the backup. After creating a new backup, it will delete backups that are older than 15 days, with the exception of backups created the first of every month. It is recommended to create a seperate database user specifically for backup purposes, and to set the permissions of this script to prevent access to the login details. Backup scripts for different databases should be run in seperate folders or they will overwrite each other.
HOSTNAME=
USERNAME=
PASSWORD=
DATABASE=
@cb372
cb372 / riscv.md
Last active June 29, 2025 12:17
Writing an OS in Rust to run on RISC-V

(This is a translation of the original article in Japanese by moratorium08.)

(UPDATE (22/3/2019): Added some corrections provided by the original author.)

Writing your own OS to run on a handmade CPU is a pretty ambitious project, but I've managed to get it working pretty well so I'm going to write some notes about how I did it.

@ejdoh1
ejdoh1 / run.sh
Last active December 11, 2023 21:43
AWS SSM Agent Raspberry Pi Installation
# AWS SSM Agent RPi Installation
# First get an SSM agent activate code
# - Login to the AWS web console and browse to the AWS Systems Manager service (SSM).
# - Under Instances & Nodes, select Hybrid Activations
# - Select 'Create activation', fill-out the form and get an activation code
# Login to your server via SSH and run the following commans, entering the code, id and region values
mkdir /tmp/ssm
sudo curl https://s3.amazonaws.com/ec2-downloads-windows/SSMAgent/latest/debian_arm/amazon-ssm-agent.deb -o /tmp/ssm/amazon-ssm-agent.deb
@zaenk
zaenk / privileges.md
Created November 21, 2020 21:48
PostgreSQL grant privileges for future tables

Spring Boot makes database migration with Flyway or Liquibase almost effortless - but by default it will use the spring.datasource.* credentials when running the migrations, which kinda suggests that this user should have ALL PRIVILEGES on the schema. This is risky, because... well if you find this page, you probably familiar with poor little Bobby Tables.

Spring Boot also makes it possible to configure separate credentials for running database migrations with the spring.flyway.* or spring.liquibase.* properties.

I prefer app credetials this way: an app owner with ALL PRIVILEGES to run the migrations and an app user with least privileges, mostly CRUD or some limited EXECUTE for the app itself.

@Binary-Eater
Binary-Eater / default.nix
Created July 29, 2023 17:58
Nix shell for linux kernel development
{ pkgs ? import <nixpkgs> {}, unstable ? import <nixos-unstable> {} }:
let
binutils = unstable.binutils; # need binutils >=2.39 for DWARF5 debuginfo
llvmPackages_14 = unstable.llvmPackages_14;
sphinx = unstable.sphinx; # need sphinx >=5.x.x due to https://github.com/sphinx-doc/sphinx/issues/10495
in
pkgs.mkShell {
SPHINXBUILD = "${pkgs.sphinx}/bin/sphinx-build";