Skip to content

Instantly share code, notes, and snippets.

View RhydianJenkins's full-sized avatar
🏠
Working from home

Rhydian Jenkins RhydianJenkins

🏠
Working from home
View GitHub Profile
@RhydianJenkins
RhydianJenkins / download_unsplash.sh
Created November 27, 2023 21:42
Download images from unsplash
#!/usr/bin/bash
for i in {1..1000} ; do
NAME='unsplash_wallpaper_'${i}
wget -q -O $NAME.jpg https://unsplash.it/7680/4320/?random
echo "Downloaded "${NAME}
done

Keybase proof

I hereby claim:

  • I am rhydianjenkins on github.
  • I am rljenkins (https://keybase.io/rljenkins) on keybase.
  • I have a public key ASDVg5slFSvIhEgf2cenb1dHGMF2ijLd38czpsYVcjc5bAo

To claim this, I am signing this object:

[
{
"key": "ctrl+oem_4",
"command": "spaceBlockJumper.moveUp",
"when": "textInputFocus",
},
{
"key": "ctrl+oem_6",
"command": "spaceBlockJumper.moveDown",
"when": "textInputFocus",
@RhydianJenkins
RhydianJenkins / sumArray.js
Created February 10, 2022 20:39
Find the two indexes of an array where their values equal a given target (O(n^2) solution)
// function to check answer
function checkAnswer(arr, target, index1, index2) {
return arr[index1] + arr[index2] === target;
}
// generate array with random numbers
const length = 100
const target = 90
const a = Array.from({ length }, () => Math.floor(Math.random() * 100)).sort()
@RhydianJenkins
RhydianJenkins / fastestThree.js
Last active February 7, 2022 22:26
There are 25 horses. What is the minimum number of races needed so you can identify the fastest 3 horses? You can race up to 5 horses at a time, but you don't have a watch.
/**
* There are 25 horses.
* What is the minimum number of races needed so you can identify the fastest 3 horses?
* You can race up to 5 horses at a time, but you don't have a watch.
*/
/**
* Cheats and uses Array.sort to find fastest horses.
* Returns true if the winnerIds are indeed the fastest horses.
*/
@RhydianJenkins
RhydianJenkins / Launch.json (Jest tests)
Created January 26, 2022 10:43
VSCode launch json file with a jest runner
{
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [
{
"type": "node",
"name": "Docker: Jest Tests",
"request": "launch",
"program": "${workspaceFolder}/node_modules/.bin/jest",
"args": [
@RhydianJenkins
RhydianJenkins / VSCode_settings.json
Last active March 26, 2022 21:39
Settings json file for my vs code setup.
{
"window.title": "${dirty} ${folderName}${separator}${activeEditorShort} ${dirty}",
"editor.fontFamily": "Cascadia Code, Fira Code",
"editor.fontLigatures": true,
"editor.formatOnSaveMode": "modifications",
"editor.cursorSurroundingLines": 8,
"editor.cursorSmoothCaretAnimation": true,
"editor.gotoLocation.alternativeTypeDefinitionCommand": "editor.action.goToTypeDefinition",
"editor.gotoLocation.multipleTypeDefinitions": "gotoAndPeek",
"editor.minimap.enabled": true,
@RhydianJenkins
RhydianJenkins / findPrimeNumbers.js
Last active September 8, 2021 19:52
Fetches the first `numPrimes` prime numbers.
const numPrimes = 200;
const primeNumbers = [1];
const raceCondPrevent = 99999; // max num iterations, to prevent an inf loop
const isPrime = num => {
for(let i = 2; i < num; i++) {
if (num % i === 0) return false;
}
return num > 1;
}