Skip to content

Instantly share code, notes, and snippets.

@rodmcnew
rodmcnew / iframe-killa.js
Last active March 2, 2022 23:07
This is a bookmarklet that removes all iframes from the current page. Paste its code into a bookmark URL field. Click the bookmark to remove all iframes. Once started, it also removes newly spawned iframes every 100ms.
javascript:void(function(){setInterval(function(){document.querySelectorAll('iframe').forEach(function(element){console.log('Iframe Killa - Removing Element:', element);element.parentNode.removeChild(element)})},100)}());
// Returns black or white foreground color depending on the background
var textColor = function (backgroundColor) {
var result = /^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(backgroundColor);
if (!result) {
return '#000000';//Happens when not given hex
}
var shade = (parseInt(result[1], 16) + parseInt(result[2], 16) + parseInt(result[3], 16)) / 3;
return shade > 128 ? '#000000' : '#FFFFFF';
}
@rodmcnew
rodmcnew / express js dump response body.js
Created October 29, 2021 23:17
express js dump response body.js
app.use('/oidc',function (req, res, next) {
const oSend = res.end;res.end = (a,b,c) => {console.log('rod send', a,b,c);res.send=oSend;res.send(a,b,c)};
const oAppend = res.end;res.end = (a,b,c) => {console.log('rod append', a,b,c);res.append=oAppend;res.append(a,b,c)};
const oEnd = res.end;res.end = (a,b,c) => {console.log('rod end', a,b,c);res.end=oEnd;res.end(a,b,c)};
oidc.callback()(req,res,next);
})
@rodmcnew
rodmcnew / windows-apple-touchpad-driver
Last active December 25, 2020 00:47
How to Windows
Go to github releases, download, unzip, right click and click "install".
https://github.com/imbushuo/mac-precision-touchpad
#from https://apple.stackexchange.com/questions/159548/prevent-auto-pairing-for-certain-devices-bluetooth
#mac address from sudo defaults read /Library/Preferences/com.apple.Bluetooth.plist DeviceCache
sudo defaults write /Library/Preferences/com.apple.Bluetooth.plist IgnoredDevices -array-add 88-d0-39-c3-ee-31
@rodmcnew
rodmcnew / just call the acl service.ts
Last active June 18, 2019 16:27
loopback 4 ACL possible implementations usage
import {
Filter, repository,
} from '@loopback/repository';
import {
get,
getFilterSchemaFor,
HttpErrors,
param,
Request,
RestBindings,
<?php
class KeepAliveStream implements \Psr\Http\Message\StreamInterface
{
protected $doneMessage;
protected $keepAliveMessage;
protected $isDone = false;
public function __construct($keepAliveMessage = '.', $doneMessage = 'Done.')
{
@rodmcnew
rodmcnew / Bank Net Balance Bookmarklet
Last active June 29, 2018 23:26
Bank Net Balance Bookmarklet
javascript:(function () { function getValue(selector) { return document.querySelector(selector) .innerHTML.replace('$', '').replace(',', '') } alert(Math.round(getValue('#DepositAccountsTable .accountRowLast') - getValue('#CreditsTable .accountRowLast'))); })();
@rodmcnew
rodmcnew / RendererMustache.php
Created April 30, 2018 17:43
How to make RCM support jsonStringify mustache lambda.
<?php
namespace Rcm\Block\Renderer;
use Rcm\Block\Config\Config;
use Rcm\Block\Config\ConfigRepository;
use Rcm\Block\InstanceWithData\InstanceWithData;
class RendererMustache implements Renderer
{
@rodmcnew
rodmcnew / socks-ssh-tunnel.bash
Created July 17, 2017 18:15
socks-ssh-tunnel.bash
#Fill in these two vars and then set this script to run every minute in cron
REMOTE_HOST="somewhere.com"
LOCAL_PORT="12345"
#Leave this part alone
SSH_ARGS="$REMOTE_HOST -D $LOCAL_PORT -f -C -q -N"
START_COMMAND="ssh $SSH_ARGS"
echo ""
echo "Start command:"
echo $START_COMMAND