Skip to content

Instantly share code, notes, and snippets.

fn pig_latin_word(word: &str) -> String {
let mut chars_iter = word.chars();
let mut first_last = if let Some(first) = chars_iter.next() {
let mut rest: String = chars_iter.collect();
rest.push(first);
rest
} else {
"".to_owned()
};
@jonfk
jonfk / template.sh
Created January 6, 2020 16:55
Default header for bash scripts
#!/bin/bash
# abort on nonzero exitstatus
set -o errexit
# abort on unbound variable
set -o nounset
# don't hide errors within pipes
set -o pipefail
# Print each command for debugging
# set -o xtrace
@jonfk
jonfk / hollow_knight_fix_dualsense.md
Last active January 17, 2026 14:03
Fix to use dualsense controller in hollow knight on linux

Map dualsense controller manually and disable Steam Input

This fixes the issue of swapped buttons and Triggers in the dualsense controller opening the pause menu The issue is caused by the SDL version used by hollow knight not recognizing the dualsense controller and mapping buttons properly. It is also not helped by steam input not disabling the native controller support when used in hollow knight. The issue cannot be fixed by simple mapping in steam input.

  1. Disable Steam Input
  2. Set the following as launch option
@jonfk
jonfk / bookmarklet_image_dwl.js
Last active October 26, 2022 18:20 — forked from lucidBrot/bookmarklet_image_dwl.js
Bookmarklet to download some images on a page
// as one-liner for bookmarklet
javascript:;(function(){var images=document.querySelector('#background.player').children;try{for (let img of images) {downloadResource(img.src)}}catch(e){alert("Download failed.");console.log('Download failed.',e)}function forceDownload(blob,filename){var a=document.createElement('a');a.download=filename;a.href=blob;a.click()}function downloadResource(url,filename){if(!filename)filename=url.split('\\').pop().split('/').pop();fetch(url,{headers:new Headers({'Origin':location.origin}),mode:'cors'}).then(response=>response.blob()).then(blob=>{let blobUrl=window.URL.createObjectURL(blob);forceDownload(blobUrl,filename)}).catch(e=>console.error(e))}}).call(window);