Skip to content

Instantly share code, notes, and snippets.

View mikeyjk's full-sized avatar
🕹️

mikeyjk mikeyjk

🕹️
View GitHub Profile
@mikeyjk
mikeyjk / console-snippet.js
Last active May 20, 2023 14:44
log all steam games from steam web library
// i just wanna see all my games in plain text format
document.querySelectorAll('[class^="gameslistitems_GameName_"]').forEach(e => { console.log(e.text); });
// or maybe
var games = '';
document.querySelectorAll('[class^="gameslistitems_GameName_"]').forEach(g => {
games = games === '' ? games = g.text : games += ', ' + g.text;
});
console.log(games);
@mikeyjk
mikeyjk / generate_psx_m3u.sh
Last active February 9, 2023 18:06
generate m3u's for backups of PS1 games you own the original hardware for, that are in .7z or .cue format
#!/usr/bin/env bash
# Usage: ./generate_psx_m3u.sh
# small tweak on: https://github.com/danyboy666/Generate-PSX-m3u-playlist/blob/master/generate_psx_m3u.sh
for rom in *{.rar,.chd,.zip,.pbp,.PBP,.7z,.cue}; do
if [[ $rom =~ ^.*[dD]is[ckCK].*$ ]]; then
playlistName=$(echo "$rom" | sed 's/.rar//g;s/.chd//g;s/.zip//g;s/.pbp//g;s/.PBP//g;s/.7z//g;s/.cue//g;s/\s[\(][dD]is[ckCK]\s[0-9]\{1,2\})//g')
echo -e "rom: $rom"
echo -e "playlist: $playlistName"
echo "$rom" >> "$playlistName"".m3u"
@mikeyjk
mikeyjk / buildQueryString.ts
Last active February 19, 2022 12:40
encode ParsedUrlQuery to a query string (I later realised an encode func already exists) (I then later realised I didn't need this at all)
import { ParsedUrlQuery } from 'querystring';
import { isArray } from 'lodash';
// allows params with no val
const buildQueryStringFromParams = (params: ParsedUrlQuery = {}): string =>
Object.keys(params)
.map((p, i) => {
const separator = i ? '&' : '?';
const value = params[p] || '';
@mikeyjk
mikeyjk / tdsCloneAndCompile.sh
Created August 26, 2020 07:09
Compile FreeTDS with pdo_dblib support
git clone https://github.com/FreeTDS/freetds.git
cd freetds
git checkout branch-1_2
./autogen.sh
./configure --enable-msdblib
make
make install
tsql -C
@mikeyjk
mikeyjk / xrandr-dock.sh
Last active August 26, 2020 07:14
scratchpad notes on workaround for dell d6000 dock issues (bash history command)
375 xrandr --setprovideroutputsource 0 1
376 xrandr --setprovideroutputsource 1 0
377 xrandr --setprovideroutputsource 1 2
378 xrandr --setprovideroutputsource 1 3
379 xrandr --setprovideroutputsource 1 4
380 xrandr --setprovideroutputsource 0 1
381 xrandr --setprovideroutputsource 0 2
382 xrandr --setprovideroutputsource 0 3
383* xrandr --setprovideroutputsource
384 xrandr --listproviders
@mikeyjk
mikeyjk / getPictureMetadata.php
Last active April 24, 2020 01:04
given the raw contents of an image file, determine the mime type and file extension
<?
/**
* Given raw image data, return the file extension and MIME type of the file.
* The file extension includes the period character ('.').
*
* If the picture contents are invalid or corrupted, the values will be null.
*
* @param $picture
* @return array
@mikeyjk
mikeyjk / .bashrc
Created April 14, 2020 08:22
bash aliases
force_color_prompt=yes
# append to the history file, don't overwrite it
shopt -s histappend
shopt -s globstar # allow dir pattern matching
shopt -s checkwinsize
# for setting history length see HISTSIZE and HISTFILESIZE in bash(1)
HISTSIZE=10000
HISTFILESIZE=20000
@mikeyjk
mikeyjk / nice-wrapper.sh
Created May 2, 2019 08:38
grep logs being 'nicer' to CPU and IO
nice -n 19 ionice -c3 $yourStuff
@mikeyjk
mikeyjk / s3rm.js
Created May 1, 2018 07:20
jQuery for deleting S3 assets via web UI
jQuery('.columbia-table.object-table-versioned > table > tbody > tr').each(function () {
if (
jQuery(this).find('td a.list-view-item-name') &&
// jQuery(this).find('td a.list-view-item-name').text().indexOf("Apr 4, 2018 2:04:00 PM") >= 0 &&
jQuery(this).find('td a.list-view-item-name').text().indexOf("(Delete marker)") >= 0
) {
jQuery(this).find('td input').click();
}
});
@mikeyjk
mikeyjk / windows.ahk
Last active April 9, 2020 00:44
Windows AHK
; i3/bswp+sxhkd/awesome-esque terminal opening:
;#Enter::Run, "C:\Program Files\PuTTY\putty.exe" -load "lamp"
#enter::
Run "C:\Program Files (x86)\Mobatek\MobaXterm\MobaXterm.exe"
Return
; lcaps -> lctrl
$CapsLock::Ctrl
; set window to sit in front of all others