Here is how you can emulate Azure managed identity on your local system by running an instance metadata service identity endpoint and simulating the token API to return an access token from Azure CLI. You can use this for example to log into SQL Server Management studio using your Azure CLI identity, or locally test code that uses the "Azure only" [ManagedIdentityCredential](https://learn
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// ----------------------------------------------------------------------------- | |
// Azure RG Janitor - Spectre Edition | |
// Run with: dotnet run cleanup-rg.cs | |
// Targets: .NET 10 Preview 4+ | |
// ----------------------------------------------------------------------------- | |
#:package Azure.Identity@1.* | |
#:package Azure.ResourceManager@1.* | |
#:package [email protected] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdio.h> | |
#include <stdlib.h> | |
#include <time.h> | |
#define N (1 << 21) // 2^21 | |
void loop_stride_256(int *a) { | |
for (int i = 0; i < N; i += 256) { | |
a[i]++; | |
} |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from http.server import BaseHTTPRequestHandler, HTTPServer | |
class SimpleHTTPRequestHandler(BaseHTTPRequestHandler): | |
def do_OPTIONS(self): | |
# dump the request pretty | |
print(f"OPTIONS {self.path} {self.request_version}") | |
# dump all the request headers | |
print(f"Request headers:") | |
for header, value in self.headers.items(): | |
print(f" {header}: {value}") |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
share-react-project() { | |
if [[ -z "$1" ]]; then | |
echo "Usage: share-react-project <project_name>" | |
return 1 | |
fi | |
local project_name="$1" | |
local github_username=$(gh api /user --jq '.login') | |
echo "Creating Vite project: $project_name" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Check for wget, if not installed, install it | |
(type -p wget >/dev/null || (sudo apt update && sudo apt-get install wget -y)) \ | |
&& sudo mkdir -p -m 755 /etc/apt/keyrings | |
# Set keyring path based on existence of /usr/share/keyrings/githubcli-archive-keyring.gpg | |
# If it is in the old location, use that, otherwise always use the new location. | |
if [ -f /usr/share/keyrings/githubcli-archive-keyring.gpg ]; then | |
keyring_path="/usr/share/keyrings/githubcli-archive-keyring.gpg" | |
else | |
keyring_path="/etc/apt/keyrings/githubcli-archive-keyring.gpg" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"configurations": [ | |
{ | |
"name": "Linux", | |
"includePath": [ | |
"${workspaceFolder}", | |
"LINUX_PATH/include", | |
"LINUX_PATH/include/uapi", | |
"LINUX_PATH/include/generated", | |
"LINUX_PATH/arch/x86/include", |
NewerOlder