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
| { | |
| "permissions": { | |
| "allow": [ | |
| "Bash(aws * describe-*)", | |
| "Bash(aws * get-*)", | |
| "Bash(aws * list-*)", | |
| "Bash(aws pricing:*)", | |
| "Bash(az * list:*)", | |
| "Bash(az * show:*)", | |
| "Bash(az monitor diagnostic-settings list:*)", |
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
| func GroupAdjacentFunc[T any, K comparable](seq iter.Seq[T], by func(item T) K) iter.Seq[[]T] { | |
| return func(yield func([]T) bool) { | |
| var group []T | |
| var groupKey K | |
| for item := range seq { | |
| key := by(item) | |
| if key == groupKey { | |
| group = append(group, item) | |
| } else { | |
| if len(group) > 0 && !yield(group) { |
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
| { | |
| /* Home */ | |
| "\UF729" = "moveToBeginningOfLine:"; | |
| "^\UF729" = "moveToBeginningOfDocument:"; | |
| "$\UF729" = "moveToBeginningOfLineAndModifySelection:"; | |
| "^$\UF729" = "moveToBeginningOfDocumentAndModifySelection:"; | |
| /* End */ | |
| "\UF72B" = "moveToEndOfLine:"; | |
| "^\UF72B" = "moveToEndOfDocument:"; |
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
| import { components } from "@octokit/openapi-types"; | |
| import { Octokit } from "@octokit/rest"; | |
| const dryrun = false; | |
| const octokit = new Octokit({ auth: process.env.GITHUB_TOKEN }); | |
| type Issue = components["schemas"]["issue"]; | |
| async function fetchAndMarkBugIssues(owner: string, repo: string) { | |
| // Fetch all issues (paginated) |
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
| // Portable Wake-On-Lan by Lionello Lunesu, placed in the public domain | |
| #ifdef _WIN32 | |
| #define WIN32_LEAN_AND_MEAN | |
| #include <windows.h> | |
| #include <winsock2.h> | |
| #ifdef _MSC_VER | |
| #pragma comment(lib, "ws2_32.lib") | |
| #endif | |
| #else | |
| #include <sys/socket.h> |
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
| #! /usr/bin/env nix-shell | |
| #! nix-shell -i python3 -p python3Packages.boto3 | |
| # Canonical URL: https://gist.github.com/lionello/f322e24135aef81d5ab9c6086c5604cf | |
| import boto3 | |
| s3 = boto3.client("s3") | |
| def delete_object_versions(bucket, prefix): | |
| paginator = s3.get_paginator("list_object_versions") | |
| pages = paginator.paginate(Bucket=bucket, Prefix=prefix) |
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
| #!/usr/bin/env rdmd | |
| // Get rdmd from https://dlang.org/download.html (or brew, nix, apt, yum) | |
| // Copyright Lionello Lunesu. Placed in the public Domain. | |
| // https://gist.github.com/lionello/84cad70f835131198fee4ab7e7592fce | |
| import std.stdio : writeln, File; | |
| int main(string[] args) { | |
| import std.process : environment, pipeShell, wait, Redirect; | |
| import std.stdio : stdout; |
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
| #!/bin/bash | |
| # Canonical version: https://gist.github.com/lionello/8fb32ee065774b934ab9af62fd269e39 | |
| # Inspired by https://stackoverflow.com/a/69300514/2017049 | |
| REGISTRY="registry-1.docker.io" | |
| ref="${1:-library/ubuntu:latest}" | |
| repo="${ref%:*}" | |
| tag="${ref##*:}" | |
| token=$(curl -sSLf "https://auth.docker.io/token?service=registry.docker.io&scope=repository:${repo}:pull" \ |
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
| <script> | |
| async function powFetch(url, options = {}) { | |
| if (window.crypto && window.crypto.subtle) { | |
| let bodyHash, nonceArray = new Uint32Array(1), nonce = 0; | |
| const body = new TextEncoder().encode(options.body); | |
| const bodyWithNonce = new Uint8Array(nonceArray.byteLength + body.byteLength); | |
| bodyWithNonce.set(body, nonceArray.byteLength); | |
| do { | |
| nonceArray[0] = ++nonce; | |
| bodyWithNonce.set(new Uint8Array(nonceArray.buffer)); |
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
| # Use an official Node runtime based on slim as a parent image | |
| FROM node:20-slim | |
| # Set the working directory to /app | |
| WORKDIR /app | |
| # Install curl and any other dependencies | |
| RUN apt-get update \ | |
| \ | |
| && apt-get install -y --no-install-recommends \ |
NewerOlder