Skip to content

Instantly share code, notes, and snippets.

View hugojosefson's full-sized avatar
👍

Hugo Josefson hugojosefson

👍
View GitHub Profile
@adtac
adtac / Dockerfile
Last active April 13, 2024 22:33
#!/usr/bin/env docker run
#!/usr/bin/env -S bash -c "docker run -p 8080:8080 -it --rm \$(docker build --progress plain -f \$0 . 2>&1 | tee /dev/stderr | grep -oP 'sha256:[0-9a-f]*')"
# syntax = docker/dockerfile:1.4.0
FROM node:20
WORKDIR /root
RUN npm install sqlite3
@martpet
martpet / deno-indexes.ts
Last active June 15, 2023 08:08
Unique and non-unique indexes with Deno KV
const kv = await Deno.openKv();
interface Choice {
id: string;
poll: string;
title: string;
}
export async function setChoice(choice: Choice) {
const primaryKey = ["choices", choice.id];
@hugojosefson
hugojosefson / install_deno_in_alpine.sh
Created March 4, 2023 16:04
Install glibc+deno in alpine 3.17
#!/bin/sh
# Install glibc, deno in alpine 3.17
apk add curl wget unzip
export LANG=C.UTF-8
curl -sfSL https://raw.githubusercontent.com/Docker-Hub-frolvlad/docker-alpine-glibc/ce0f46a806ce7299dd24c14c8212bb2fc2374ab4/Dockerfile | sed -n '/RUN /,$p' | sed 's/^RUN //' | sh
curl -fsSL https://deno.land/x/install/install.sh | DENO_INSTALL=/usr/local sh
@moyix
moyix / killbutmakeitlooklikeanaccident.sh
Created February 5, 2022 22:51
Script to inject an exit(0) syscall into a running process. NB: only x86_64 for now!
#!/bin/bash
gdb -p "$1" -batch -ex 'set {short}$rip = 0x050f' -ex 'set $rax=231' -ex 'set $rdi=0' -ex 'cont'
@MrChocolatine
MrChocolatine / TS - More precise return type method Date#toISOString.d.ts
Last active February 22, 2024 22:06
TypeScript – How to accurately type dates in ISO 8601 format
// In TS, interfaces are "open" and can be extended
interface Date {
/**
* Give a more precise return type to the method `toISOString()`:
* https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date/toISOString
*/
toISOString(): TDateISO;
}
type TYear = `${number}${number}${number}${number}`;
@lmmx
lmmx / nosnap.pref
Created February 2, 2021 09:23
Contents of `/etc/apt/preferences.d/nosnap.pref` in Linux Mint 20.1 (removed manually to install `snapd`) https://linuxmint-user-guide.readthedocs.io/en/latest/snap.html
# To prevent repository packages from triggering the installation of Snap,
# this file forbids snapd from being installed by APT.
# For more information: https://linuxmint-user-guide.readthedocs.io/en/latest/snap.html
Package: snapd
Pin: release a=*
Pin-Priority: -10
@yvesh
yvesh / proxmox-zfs-encryption.md
Last active March 12, 2024 04:52
Proxmox 6.1 ZFS native full disk (ZFS root) encryption.

Simple guide for fulldisk encryption with Proxmox and ZFS native encryption

Install normally using the installer, after the setup reboot into recovery mode (from the USB stick). Make sure to install in UEFI mode (you need systemd-boot).

If the USB stick is not working for you, because of the old Kernel version (2.6.x), you can also use an Ubuntu 19.10 / 20.04 boot stick. ZFS suport is enabled there out of the box.

Steps:

@cubedtear
cubedtear / script.sh
Last active July 7, 2023 04:37
Self-updating bash script
#!/usr/bin/env bash
VERSION="0.0.2"
SCRIPT_URL='https://gist.github.com/cubedtear/54434fc66439fc4e04e28bd658189701/raw'
SCRIPT_DESCRIPTION=""
SCRIPT_LOCATION="${BASH_SOURCE[@]}"
rm -f updater.sh
function update()
{
@plembo
plembo / RPIwithQEMU.md
Last active April 24, 2024 14:46
Emulating a Raspberry Pi with QEMU

Emulating a Raspberry Pi with QEMU

Goal: Emulate a Raspberry Pi with QEMU in order to run the Raspbian O/S (based on Debian Linux).

The current setup is not ideal. For one thing, the maximum RAM allowed using the "versatile-pb" firmware is 256 Mb. In addition, only the most basic peripherals, a keyboard and mouse, are supported.

A number of articles have been written on this topic. Most are outdated, and the few recent ones are missing key information.

@zulhfreelancer
zulhfreelancer / README.md
Last active January 28, 2021 22:33
How to install Flynn on single host (single-node mode)?

$ sudo bash -c "$(curl -s https://gist.githubusercontent.com/zulhfreelancer/0b87a274686cb4d98b8144e116c5117c/raw)"