Skip to content

Instantly share code, notes, and snippets.

@BenjaminArmstrong
BenjaminArmstrong / VMCXEditor.ps1
Created April 19, 2017 00:18
PowerShell to edit VMCX files
# Editing a virtual machine file
# This PowerShell code takes an unregistered VMCX file
# It change the VM Name, disables Dynamic Memory, and sets the memory to 2GB
# It then saves the changed virtual machine configuration to a new path
# Parameters that will be changed
$VMConfigurationToEdit = "D:\VMs\Virtual Machines\3F99446F-1D9A-4010-8C8B-4E554E845181.vmcx"
$pathToSaveNewConfigTo = "D:\"
$newVMName= "NewVMName"
@bradtraversy
bradtraversy / terminal-commands.md
Last active May 7, 2024 20:55
Common Terminal Commands

Common Terminal Commands

Key Commands & Navigation

Before we look at some common commands, I just want to note a few keyboard commands that are very helpful:

  • Up Arrow: Will show your last command
  • Down Arrow: Will show your next command
  • Tab: Will auto-complete your command
  • Ctrl + L: Will clear the screen
@ethanclevenger91
ethanclevenger91 / after.sh
Last active May 7, 2024 20:54
Install PHP SQLSRV database extension on Laravel Homestead (probably works as a Laravel Forge recipe, too). Thanks @richvida
#!/bin/sh
PHP_MSSQL_DRIVERS=Ubuntu18-7.3
PHP_MSSQL_RELEASE=5.6.1
# Download and extract phpmysql drivers
sudo wget "https://github.com/Microsoft/msphpsql/releases/download/v${PHP_MSSQL_RELEASE}/${PHP_MSSQL_DRIVERS}.tar" -O - | tar -x
# Change Directory
cd $PHP_MSSQL_DRIVERS
@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