Skip to content

Instantly share code, notes, and snippets.

@shamil
shamil / mount_qcow2.md
Last active May 7, 2024 20:53
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
Alpine.directive('typed', (el, { expression, modifiers }, { evaluateLater, effect, cleanup }) => {
const getStrings = evaluateLater(expression);
const modifierValue = (key, fallback) => {
if (-1 === modifiers.indexOf(key)) {
return fallback;
}
const value = modifiers[modifiers.indexOf(key) + 1];
@leommoore
leommoore / file_magic_numbers.md
Last active May 7, 2024 20:49
File Magic Numbers

File Magic Numbers

Magic numbers are the first bits of a file which uniquely identify the type of file. This makes programming easier because complicated file structures need not be searched in order to identify the file type.

For example, a jpeg file starts with ffd8 ffe0 0010 4a46 4946 0001 0101 0047 ......JFIF.....G ffd8 shows that it's a JPEG file, and ffe0 identify a JFIF type structure. There is an ascii encoding of "JFIF" which comes after a length code, but that is not necessary in order to identify the file. The first 4 bytes do that uniquely.

This gives an ongoing list of file-type magic numbers.

Image Files

@conradfuhrman
conradfuhrman / herd-reverb-ssl.md
Last active May 7, 2024 20:50
Laravel Herd, SSL, and Reverb with Herd

The biggest issue with Herd Pro is that you cannot use Reverb out of the box with a site that has SSL enabled. Here is the workaround for it all to play nicely together.

First you will need to create two sites. The two I have here are as follows:

  • reverb-ssl - This is a new Laravel 11 project using Breeze for the ease of Inertia. This also follows the setup for Reverb line by line.
  • wss-reverb-ssl - This is an empty directory, we are going to use this only for editing a Nginx config and setting up a proxy to the reverb service.

Screenshot 2024-04-03 at 2 33 08 PM

Of note is that I'm using Herd Pro as well, so all additional services are being used directly though Herd Pro itself.

@JohnnyTurbo
JohnnyTurbo / BattleStageManagedData.cs
Last active May 7, 2024 20:45
Code used in ECS Transforms tutorial video on the Turbo Makes Games YouTube Channel - https://youtu.be/NGLVVI2HAo4
using Unity.Entities;
using UnityEngine;
namespace TMG.ECS_Transforms
{
[GenerateAuthoringComponent]
public class BattleStageManagedData : IComponentData
{
public Transform TrackFollower;
}
@knu2xs
knu2xs / init.d.md
Last active May 7, 2024 20:42
ArcGIS on Ubuntu Install Notes

No worries. You do need to copy it to the /etc/init.d as you mentioned. This will only tell the system how it can start/stop/restart the arcgisserver service. However you still need to tell it you want it to start at boot.

All the major distros now use something called systemD which handles starting up the system, so you have to do two other small things, listed below, to get it to start on boot.

To interact with system you mainly use the systemctl command to tell it what you want to do .

  1.  The following will tell systemD to start the arcgisserver service.

systemctl start arcgisserver

  1. This next command will tell systemD to start it EACH time it boots up.
@francois-rozet
francois-rozet / flow_matching.py
Last active May 7, 2024 20:40
Flow Matching in 100 LOC
#!/usr/bin/env python
import math
import matplotlib.pyplot as plt
import torch
import torch.nn as nn
from sklearn.datasets import make_moons
from torch import Tensor
from tqdm import tqdm
@thevickypedia
thevickypedia / sphinx-pydantic.md
Last active May 7, 2024 20:38
Configure sphinx docs when using Pydantic

Sphinx Auto-docs and Pydantic Configuration

Sphinx autogen docs and pydantic don't get along.

Problem:

  • Using the BaseModel from pydantic takes the class members as arguments.
    • These arguments are displayed (along with the values) in the docs whether the user wants it or not.
@joshbuchea
joshbuchea / semantic-commit-messages.md
Last active May 7, 2024 20:37
Semantic Commit Messages

Semantic Commit Messages

See how a minor change to your commit message style can make you a better programmer.

Format: <type>(<scope>): <subject>

<scope> is optional

Example

@Zhuinden
Zhuinden / BasicTextFieldWithCursorAtEnd.kt
Last active May 7, 2024 20:37
A Compose TextField that initializes the cursor position at the end of the text, rather than the start, when focused without tapping the TextField manually.
/*
* Copyright 2020 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software