I needed a function to hash a cell's content in Microsoft Excel. Internal calls to .NET functions don't work on a Mac. Also the Python-Integration is only available in Business-Plans. So I wrote a VBA function to hash a string with SHA256 on a Mac.
This VBA function uses the Mac's internal sha256
implementation, makes a system call and returns the hash. The function is called SHA256_Mac
and takes a string as input. The function returns the hash as a string.
Add it to your macro-enabled Excel file and use it like this:
=SHA256_Mac("abc")
If you want to convert a wav file to 16 kHz for whisper in Rust, you can use the following script. It uses the hound
crate to read and write wav files and rubato to resample the audio.
Reads a file as input.wav
and returns a converted wav as output.wav
.
use rubato::{
Resampler, SincFixedIn, SincInterpolationParameters, SincInterpolationType, WindowFunction,
};
Let's assume we have a post type employee
and some categories. We want to get all employees, who are assigned to a specific category to add them via a shortcode. The shortcode should have two attributes: category
and layout
. The category
attribute should accept a comma-separated list of category slugs or IDs. The layout
attribute should define the output layout: grid
or slider
.
Here is an example of how to create a shortcode to list employees by category:
/**
* Listing of employees by category
*
* Example: [employee category="Physiotherapie" layout="grid"]
* - layout="grid": Displays the employees in a grid (default)
This script creates a sitemap based on the page.tsx
-files found in your app-directory.
Create a file called sitemap.ts
inside of your app/
directory of your NextJS application.
Then fill it with this script:
import { globby } from "globby"
import type { MetadataRoute } from "next"
- Arduino Nano ESP32
- OLED Display Module
- Libraries used:
The sketch is not by me, it's reduced to a minimum and to document for myself how I connected the display 😅
Strapi is a great project, but lacks of a good documentation concerning customization. This gist presents some of my findings / experiments to customize strapi.
My use-case: find
and findOne
need to be active to keep nested queries on other user-relations. But if I allow authenticated users to access these routes, they can access all users. So I customize these routes with my own policies:
To give access to a role from the users-permissions model in Strapi v4, you need to create a permission and add it to the role.
Useful for testing. Gives authenticated users access to the provided routes.
import request from "supertest";
import { setupStrapi, stopStrapi } from "../../../../tests/helpers/strapi";
import { createUser } from "../../../../tests/user/factory";
let user;
// Taken from https://codesandbox.io/s/wg9317 | |
// Thanks, you helped me a lot! https://github.com/haysclark | |
import strapi, { Strapi } from "@strapi/strapi"; | |
import { compile } from "@strapi/typescript-utils"; | |
import * as fs from "fs"; | |
let instance: Strapi; | |
export const setupStrapi = async (): Promise<Strapi> => { |