Skip to content

Instantly share code, notes, and snippets.

#!/usr/bin/env bash
#
# Author: Markus (MawKKe) [email protected]
# Date: 2018-03-19
#
#
# What?
#
# Linux dm-crypt + dm-integrity + dm-raid (RAID1)
#
@ldtjcdrs
ldtjcdrs / xz-backdoor.md
Created March 30, 2024 02:43 — forked from thesamesam/xz-backdoor.md
xz-utils backdoor situation

FAQ on the xz-utils backdoor

Background

On March 29th, 2024, a backdoor was discovered in xz-utils, a suite of software that gives developers lossless compression. This package is commonly used for compressing release tarballs, software packages, kernel images, and initramfs images. It is very widely distributed, statistically your average Linux or macOS system will have it installed for

@ldtjcdrs
ldtjcdrs / linux-vms-on-apple-m1-with-networking.md
Created January 2, 2024 20:46 — forked from max-i-mil/linux-vms-on-apple-m1-with-networking.md
Short summary to run Linux VMs on an Apple M1 host using QEMU, libvirt and HVF with a working network setup

Linux Virtual Machines with Private Network on an Apple M1 Device

Background

The aim was to be able to:

  1. Run multiple Linux VMs on an Apple M1/ARM device
  2. Use Apple's HVF for native performance speeds
  3. Configure VMs to allow network access to each other
  4. Configure VMs to allow access to the internet
  5. Not rely on custom modifications of software
@ldtjcdrs
ldtjcdrs / .macos-sandbox-notes
Created October 17, 2023 04:55 — forked from rrbutani/.macos-sandbox-notes
macOS sandbox notes
(placeholder to set the gist name)
@ldtjcdrs
ldtjcdrs / ip_range.clj
Created August 16, 2023 22:02 — forked from killme2008/ip_range.clj
Check private range ip in clojure
(defn- get-ip-num [^String ip]
(when ip
(when-let [groups (re-matches #"^(\d+)\.(\d+)\.(\d+)\.(\d+)$" ip)]
(let [[a b c d] (map #(Integer/valueOf ^String %) (next groups))]
(+
(* 256 256 256 a)
(* 256 256 b)
(* 256 c)
d)))))
@ldtjcdrs
ldtjcdrs / mount_qcow2.md
Created July 7, 2023 15:02 — forked from shamil/mount_qcow2.md
How to mount a qcow2 disk image

How to mount a qcow2 disk image

This is a quick guide to mounting a qcow2 disk images on your host server. This is useful to reset passwords, edit files, or recover something without the virtual machine running.

Step 1 - Enable NBD on the Host

modprobe nbd max_part=8
@ldtjcdrs
ldtjcdrs / README
Created May 31, 2023 00:46 — forked from jmatsushita/README
Setup nix, nix-darwin and home-manager from scratch on an M1 Macbook Pro
# I found some good resources but they seem to do a bit too much (maybe from a time when there were more bugs).
# So here's a minimal Gist which worked for me as an install on a new M1 Pro.
# Inspired by https://github.com/malob/nixpkgs I highly recommend looking at malob's repo for a more thorough configuration
#
# Some people are coming directly to this Gist from search results and not the original post[1]. If that sounds like you, you should also know there is a video[2] that accompanies this.
#
# [1] https://discourse.nixos.org/t/simple-workable-config-for-m1-macbook-pro-monterey-12-0-1-with-nix-flakes-nix-darwin-and-home-manager/16834
# [2] https://www.youtube.com/watch?v=KJgN0lnA5mk
#
@ldtjcdrs
ldtjcdrs / ip-addr.clj
Created May 4, 2023 04:43 — forked from punit-naik/ip-addr.clj
Get the IP address of your network card using Clojure
(import 'java.net.NetworkInterface)
(-> (->> (NetworkInterface/getNetworkInterfaces)
enumeration-seq
(map bean)
(mapcat :interfaceAddresses)
(map bean)
(filter :broadcast)
(filter #(= (.getClass (:address %)) java.net.Inet4Address)))
(nth 0)
(get :address)
@ldtjcdrs
ldtjcdrs / article.md
Created March 21, 2023 21:18 — forked from jpallari/article.md
HTML search and replace in Clojure

HTML search and replace in Clojure

In Clojure, data structures are mostly built from a handful of core data structures such as lists, vectors, maps, and sets. This means that most data structures can leverage all of the generic data transformation and querying functions built for the core data structures instead of having to rebuild the same functionality for each data structure. This feature in combination with Clojure's rich standard library makes Clojure very attractive for solving data munching problems from other domains.

In this article, I'm going to demonstrate these capabilities for solving HTML transformations using Clojure. First, I'm going to describe how HTML can be represented in Clojure. With this representation in mind, I'll demonstrate how we can transform HTML documents in Clojure. Finally, I'll tie the transformations together with the HTML parsing and formatting to produce a complete solution.

@ldtjcdrs
ldtjcdrs / clojure-learning-list.md
Created December 6, 2022 20:39 — forked from ssrihari/clojure-learning-list.md
An opinionated list of excellent Clojure learning materials

An opinionated list of excellent Clojure learning materials

These resources (articles, books, and videos) are useful when you're starting to learn the language, or when you're learning a specific part of the language. This an opinionated list, no doubt. I've compiled this list from writing and teaching Clojure over the last 10 years.

  • 🔴 Mandatory (for both beginners and intermediates)
  • 🟩 For beginners
  • 🟨 For intermediates

Table of contents

  1. Getting into the language