Skip to content

Instantly share code, notes, and snippets.

@bechynsky
bechynsky / get_group_members_msgraph.ps1
Created July 1, 2021 12:06
Simple demo how to get list of group members using Microsoft Graph for M365
# https://docs.microsoft.com/en-us/graph/powershell/installation
# https://docs.microsoft.com/en-us/graph/powershell/get-started
# https://developer.microsoft.com/en-us/graph/graph-explorer
# https://tech.nicolonsky.ch/exploring-the-new-microsoft-graph-powershell-modules/
Connect-MgGraph -Scopes "User.Read.All", "GroupMember.Read.All", "Group.Read.All", "Directory.Read.All"
$GROUP_NAME = 'Workspace'
$group = Get-MgGroup -Filter "DisplayName eq '$GROUP_NAME'"
@ca0v
ca0v / debounce.ts
Last active May 7, 2024 20:56
Typescript Debounce
// ts 3.6x
function debounce<T extends Function>(cb: T, wait = 20) {
let h = 0;
let callable = (...args: any) => {
clearTimeout(h);
h = setTimeout(() => cb(...args), wait);
};
return <T>(<any>callable);
}
@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;
}