Skip to content

Instantly share code, notes, and snippets.

@tueda
tueda / git-phantom
Last active September 22, 2025 14:11
#!/bin/bash
#
# Create an empty commit reusing author, date and message from an existing commit.
#
# Usage:
# git phantom <commit-ish>
#
set -euo pipefail
if [ $# -ne 1 ]; then
#!/bin/bash
#
# @file openssl-bench.sh
#
# Runs an OpenSSL SHA-256 benchmark and prints the time (in seconds)
# to process 1 terabyte.
#
# Usage:
# openssl-bench.sh [NUM_CPUS]
#
You will help improve a given program based on specified requirements. The original program and the intended improvements will be provided.
**Before writing any code modifications, follow these preliminary steps:**
1. **Outline Your Implementation:**
- Present an overview of your planned modifications.
2. **Identify Potential Issues:**
- Consider and list possible problems or edge cases that may arise.
3. **Finalize the Specification:**
- Clearly define the finalized specification for the improvements.
@tueda
tueda / shachk
Created March 1, 2025 07:28
Script to check SHA sums for the files in the current directory. #bin #sh
#!/bin/bash
#
# @file shachk
#
# Check SHA sums for the files in the current directory.
#
set -eu
set -o pipefail
algorithm=512
@tueda
tueda / git-latest
Created December 26, 2024 03:45
List branches sorted by commit dates. #bin #bash #git
#!/bin/bash
#
# List branches sorted by commit dates.
#
# Usage:
# git latest [--all|--tags]
#
set -eu
set -o pipefail

FORM.devcontainer

curl -s https://gist.githubusercontent.com/tueda/aa0f10331289e4a294eb6fa242f1a5ee/raw/setup.sh | bash -s -- 20.04 mpich
code = """
for i in range(100):print(i%3//2*"Fizz"+i%5//4*"Buzz"or-~i)
"""

quote = '"'

import base64
import sys
import zlib
import time
import ray
delay = 0.01
context = ray.init()
num_cpus = ray.available_resources()["CPU"]
def busy_wait(duration):
#!/bin/bash
set -eu
set -o pipefail
show_containers() {
local RED='\033[0;31m'
local GREEN='\033[0;32m'
local YELLOW='\033[1;33m'
local NOCOLOR='\033[0m'
@tueda
tueda / CheckAnswer.excel.lambda.txt
Last active July 28, 2024 11:37
Lambda function that compares specified cells, returning a score if they match. #excel #lambda
=LAMBDA(answerCell, correctAnswerCell, scoreCell,
IF(answerCell = "",
"",
IF(OR(scoreCell = "", scoreCell = "&"),
"",
LET(Z, LAMBDA(f, LET(g, LAMBDA(x, f(LAMBDA(v, LET(xx, x(x), xx(v))))), g(g))),
countRightAmpersands, Z(LAMBDA(countRightAmpersands, LAMBDA(cell,
LET(right, Offset(cell, 0, 1),
IF(right = "&",
countRightAmpersands(right) + 1,