Skip to content

Instantly share code, notes, and snippets.

@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";
@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.

@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
@cb372
cb372 / riscv.md
Last active February 23, 2025 19:31
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.

@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=
@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",
@fay59
fay59 / Quirks of C.md
Last active September 4, 2024 23:07
Quirks of C

Here's a list of mildly interesting things about the C language that I learned mostly by consuming Clang's ASTs. Although surprises are getting sparser, I might continue to update this document over time.

There are many more mildly interesting features of C++, but the language is literally known for being weird, whereas C is usually considered smaller and simpler, so this is (almost) only about C.

1. Combined type and variable/field declaration, inside a struct scope [https://godbolt.org/g/Rh94Go]

struct foo {
   struct bar {
 int x;
@kylemcdonald
kylemcdonald / ACAI (PyTorch).ipynb
Last active March 12, 2023 18:37
PyTorch ACAI (1807.07543).
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@diegopacheco
diegopacheco / latest-protobuf-ubuntu-18-04.md
Created June 7, 2018 20:13
How to Install Latest Protobuf on Ubuntu 18.04
sudo apt-get install autoconf automake libtool curl make g++ unzip -y
git clone https://github.com/google/protobuf.git
cd protobuf
git submodule update --init --recursive
./autogen.sh
make
make check
sudo make install
sudo ldconfig