sudo apt -y install testdisk
sudo photorec
require "string" | |
-- Make sure to install Hammerspoon (brew install --cask hammerspoon) and blueutil (brew install blueutil). | |
-- Ensure to give sufficient access in macOS so that the commands can be ran: | |
-- -- System Settings -> Privacy & Security -> Accessibility -> Allow Hammerspoon | |
-- -- System Settings -> Privacy & Security -> Bluetooth -> Select app "Hammerspoon" | |
-- Place this file in your home folder, then open Hammerspoon and click "Reload config" | |
function checkBluetoothResult(rc, stdout, stderr) | |
-- Use for debugging |
require "string" | |
-- Make sure to install Hammerspoon (brew install --cask hammerspoon) and blueutil (brew install blueutil). | |
-- Ensure to give sufficient access in macOS so that the commands can be ran: | |
-- -- System Settings -> Privacy & Security -> Accessibility -> Allow Hammerspoon | |
-- -- System Settings -> Privacy & Security -> Bluetooth -> Select app "Hammerspoon" | |
-- Get the MAC address of your bluetooth device (use command "blueutil --paired") | |
-- Place this file in your home folder, then open Hammerspoon and click "Reload config" | |
macAddress="" -- Bluetooth Device MAC Address |
function flactoaiff() { | |
if [[ $1 != *.flac ]]; then | |
echo "Please provide a FLAC-file" | |
return 1 | |
fi | |
newFilePath="${1/%.flac/.aiff}" | |
ffmpeg -y -nostdin -i $1 -write_id3v2 1 -c:v copy $newFilePath | |
} | |
function downsample() { |
sudo apt -y install testdisk
sudo photorec
{ | |
exampleField: { | |
_type: 'richDate', | |
local: '2024-03-12T00:00:00+01:00', | |
offset: 60, | |
utc: '2024-03-11T23:00:00.000Z', | |
timezone: 'Europe/Oslo' | |
} | |
} |
$indicator = new \Symfony\Component\Console\Helper\ProgressIndicator($this->output); | |
$indicator->start('Starting the process...'); | |
foreach (range(0, 10) as $i) { | |
usleep(5 * 10000); | |
$indicator->advance(); | |
} | |
$indicator->finish('Process complete!'); |
import React, { useEffect, useState, useRef, useCallback } from 'react'; | |
type Props = { | |
text: string | |
maxSize?: number | |
minSize?: number | |
maxHeight?: number | |
fontStepSize?: number | |
containerWidthMargin?: number | |
initialHidden?: boolean |
import libheif from 'libheif-js'; | |
import { ImageData, Canvas, createCanvas } from 'canvas' | |
type Props = { | |
buffer: Buffer; | |
quality: number; | |
}; | |
const processSingleImage = (image: any): Promise<any> => { | |
return new Promise((resolve, reject) => { |
import { useEffect, useRef } from 'react'; | |
export const useDebounce = (callback: Function, delay: number) => { | |
const timeoutRef = useRef<null|NodeJS.Timeout>(null); | |
useEffect(() => { | |
return () => { | |
if (timeoutRef.current) { | |
clearTimeout(timeoutRef.current); | |
} | |
}; | |
}, []); |
defineField({ | |
name: 'email', | |
title: 'Email', | |
type: 'string', | |
readOnly: ({document}) => document?.origin === 'Checkin', | |
description: 'Can only be changed in Checkin if the origin is "Checkin".', | |
validation: Rule => Rule.required().email().custom(async (email: any, context: any) => { | |
const response = await client.fetch(`*[_type == "user" && email == $email && !(_id in [$draftId, $id])]`, {email, draftId: context.document._id, id: context.document._id.replace('drafts.', '')}); | |
if (response?.length > 0) { | |
return 'Email already in use'; |