Skip to content

Instantly share code, notes, and snippets.

@shamil
shamil / mount_qcow2.md
Last active April 23, 2024 20:24
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
@msubel
msubel / uuid_v4_excel_formula.txt
Created July 14, 2015 12:37
An Excel Fromula to generate a UUID v4
=LOWER(CONCATENATE(DEC2HEX(RANDBETWEEN(0;POWER(16;8));8);"-";DEC2HEX(RANDBETWEEN(0;POWER(16;4));4);"-";"4";DEC2HEX(RANDBETWEEN(0;POWER(16;3));3);"-";DEC2HEX(RANDBETWEEN(8;11));DEC2HEX(RANDBETWEEN(0;POWER(16;3));3);"-";DEC2HEX(RANDBETWEEN(0;POWER(16;8));8);DEC2HEX(RANDBETWEEN(0;POWER(16;4));4)))
@BlakeGardner
BlakeGardner / install nano.sh
Last active April 23, 2024 20:22
Syntax highlighting in nano on Mac OS
# Last updated March, 2022 for Apple silicon Macs
# Install Homebrew if you don't already have it: https://brew.sh
# install nano from homebrew
brew install nano nanorc
# update your nanorc file
echo 'include "/opt/homebrew/share/nanorc/*.nanorc"' >> ~/.nanorc
# close and re-open your terminal and you'll have syntax highlighting
@jboner
jboner / latency.txt
Last active April 23, 2024 20:20
Latency Numbers Every Programmer Should Know
Latency Comparison Numbers (~2012)
----------------------------------
L1 cache reference 0.5 ns
Branch mispredict 5 ns
L2 cache reference 7 ns 14x L1 cache
Mutex lock/unlock 25 ns
Main memory reference 100 ns 20x L2 cache, 200x L1 cache
Compress 1K bytes with Zippy 3,000 ns 3 us
Send 1K bytes over 1 Gbps network 10,000 ns 10 us
Read 4K randomly from SSD* 150,000 ns 150 us ~1GB/sec SSD
@johndavisnz
johndavisnz / lockerstor-debian.md
Last active April 23, 2024 20:20
Installing Debian on the Nimbustor4/2 ( as5304t/as5202t )

Whilst Asustor's ADM suits most people, it is possible to install ANY intel operating system on the nimbustor4/2 (as5202t/as5304t) as they run fairly generic intel hardware (asmedia sata controller, rtl8125 2.5gbe nic and ite system management chip)

in this gist I'll detail the steps needed to install and configure Debian11

Before proceeding you need to decide where you're going to install Debian.

Most people will choose to install it to a usb3 attached drive - either a usb3 ssd ( samsung t5 or similar ) or a usb3 hdd. This gives the most straightforward install ( just tell Debian to use the entire usb3 drive to install to ) and maximises available space on the NAS HDDs

The other option is to install Debian direct to the NAS hard drives - that means no extra drive hanging off the nas, and you can raid1 mirror the system partition across all drives for added resiliency ( though this is somewhat limited as the EFI boot partition is only on sda - so in the case of sda failing you'd need to boot off i

@ppisarczyk
ppisarczyk / Programming_Languages_Extensions.json
Last active April 23, 2024 20:19 — forked from aymen-mouelhi/languages.json
Programming Languages and their File Extensions
[
{
"name":"ABAP",
"type":"programming",
"extensions":[
".abap"
]
},
{
"name":"AGS Script",
@Cortexelus
Cortexelus / udio.py
Last active April 23, 2024 20:19
Automate Udio (2024-04-13)
# AUTOMATE UDIO
# by DADABOTS dadabots.com
# was working on 2024-04-13
# tldr; get your login cookie, use it to automate udio from python
import requests
import json
from time import sleep
import re
@philpennock
philpennock / gitolite nats notifications in Go
Last active April 23, 2024 20:18
Golang version of git post-receive hook for gitolite to publish updates to NATS
This is for gitolite to publish notifications to NATS with details of commits.
I use the "hooks in admin repo" approach: I have root on the gitolite server and only I have commit access.
The only action taken outside of this repo was to install Go (1.15.5).
This approach uses a shell wrapper to on-demand re-compile the binary hook, which is written in Go.
Shell script: local/hooks/repo-specific/wrap-go-nats-publish.post-receive
Symlink: local/hooks/common/post-receive -> ../repo-specific/wrap-go-nats-publish.post-receive
Go source: local/src/nats-publish-postreceive.go
@intergalacticspacehighway
intergalacticspacehighway / PinchToZoom.tsx
Last active April 23, 2024 20:16
Pinch to zoom reanimated + gesture handler
import React, { useMemo, useState } from "react";
import { LayoutChangeEvent, StyleSheet } from "react-native";
import {
PinchGestureHandler,
PinchGestureHandlerGestureEvent,
} from "react-native-gesture-handler";
import Animated, {
useAnimatedGestureHandler,
useAnimatedStyle,
useSharedValue,

Azure Active Directory (AAD) Auth

This gist assumes a working Azure AD (not Azure AD-DS is already up and fully configured) This gist assumes working DNS / name resolution on your internal network.

this gist is part of this series

Create App Registrations

All of these steps will be done in the Azure Portal AAD UI

  1. Select App Registration from the nav bar