Skip to content

Instantly share code, notes, and snippets.

View patte's full-sized avatar

Patrick Recher patte

View GitHub Profile
@dmmulroy
dmmulroy / gleam_ts_gen.d.ts
Created March 14, 2024 01:05
Generating TypeScript declaration files with Gleam
import type * as $io from "../gleam_stdlib/gleam/io.d.mts";
import type * as _ from "./gleam.d.mts";
export class User extends _.CustomType {
constructor(id: string, username: string, role: Role$);
id: string;
username: string;
role: Role$;
}
@gillg
gillg / rrd_to_openmetrics.py
Last active September 11, 2024 15:43
Script to convert a set of RRD files (issued from collectd for example) to Open Metrics format (prometheus)
#!/usr/bin/env python
from __future__ import print_function
'''
Usage:
./rrd_to_openmetrics.py /path/rrd_directory/ > openmetrics.txt
'''
'''
Directory structure :
@labbots
labbots / Ubuntu 18.04 setup.md
Created June 10, 2019 11:12
Ubuntu 18.04 Manual partitioning setup with LUKS encryption and LVM - https://labbots.com/ubuntu-18-04-installation-with-luks-and-lvm

Ubuntu 18.04 installation with LUKS and LVM

Installation Process

Pre-installation from live OS

This setup of Ubuntu with LUKS and LVM is tested on Ubuntu 18.04.

Boot Ubuntu from a Live OS and select the option to try Ubuntu without installing. Follow the steps I've outlined below. Let's assume you're installing to /dev/nvme0n1.

  1. Partition the drive with your tool of choice: I used gparted to set mine up.
@mohanpedala
mohanpedala / bash_strict_mode.md
Last active November 15, 2024 17:43
set -e, -u, -o, -x pipefail explanation
@scy
scy / opening-and-closing-an-ssh-tunnel-in-a-shell-script-the-smart-way.md
Last active October 27, 2024 19:13
Opening and closing an SSH tunnel in a shell script the smart way

Opening and closing an SSH tunnel in a shell script the smart way

I recently had the following problem:

  • From an unattended shell script (called by Jenkins), run a command-line tool that accesses the MySQL database on another host.
  • That tool doesn't know that the database is on another host, plus the MySQL port on that host is firewalled and not accessible from other machines.

We didn't want to open the MySQL port to the network, but it's possible to SSH from the Jenkins machine to the MySQL machine. So, basically you would do something like

ssh -L 3306:localhost:3306 remotehost