Skip to content

Instantly share code, notes, and snippets.

double getDistance(int rssi, int txPower) {
return Math.pow(10d, ((double) txPower - rssi) / (10 * 2));
}
@martinbowling
martinbowling / sign-app.sh
Created March 24, 2020 17:21
electron app signing script
#!/bin/bash
# Name of your app.
APP="YourApp"
# The path of your app to sign.
APP_PATH="/path/to/YourApp.app"
# The path to the location you want to put the signed package.
RESULT_PATH="~/Desktop/$APP.pkg"
# The name of certificates you requested.
APP_KEY="3rd Party Mac Developer Application: Company Name (APPIDENTITY)"
@martinbowling
martinbowling / terpyj-cart.js
Created September 26, 2019 00:25
terpyjscart
/* JS INECTION CODE */
if(typeof Checkout === 'object'){
if(typeof Checkout.$ === 'function'){
/* your super duper code in here, such as: */
document.getElementById('payment_gateway_36437000235_description').innerHTML += "<a href='https://greenbyphone.com/eCheck/eCheck.aspx?GreenButton_id=13462&TransactionID='><img src='https://greenbyphone.com/eCheck/images/PayNowButton.png' border='0' alt='' /></a>";
var element = document.getElementById("payment_gateway_36437000235_description'");
element.classList.remove("visually-hidden");
}
}
/* END JS INECTION CODE */
@martinbowling
martinbowling / base64-hide-links.js
Created March 9, 2019 23:22
JS To Hide Outbound Links With Base 64
@martinbowling
martinbowling / mask-links.php
Created March 9, 2019 23:01 — forked from chrisguitarguy/mask-links.php
Mask external WordPress links behind a redirect.
@martinbowling
martinbowling / .htaccess
Created March 9, 2019 23:01 — forked from jdevalk/.htaccess
These three files together form an affiliate link redirect script.
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteRule ^index\.php$ - [L]
RewriteRule (.*) ./index.php?id=$1 [L]
</IfModule>
@martinbowling
martinbowling / scene-season-numbers.cs
Created January 9, 2019 23:05
regex for scene name season and episode numbers
string sample = "Stargate.SG-1.S01E08.iNT.DVDRip.XviD-LOCK.avi";
Regex regex = new Regex(@"S(?<season>\d{1,2})E(?<episode>\d{1,2})");
Match match = regex.Match(sample);
if (match.Success)
{
string season = match.Groups["season"].Value;
string episode = match.Groups["episode"].Value;
Console.WriteLine("Season: " + season + ", Episode: " + episode);
}
# you will need to download nzbdrone.db & some type of sqlite editor
# First We Will Update The Series Table
# Replace the slashes
UPDATE Series SET path = replace( path, '\', '/' ) WHERE path LIKE '%:\%';
# K: is the windows drive that your files were on (replace this with whatever drive your files are on, will need to repeat for each
# windows root folder you have in Sonnar), /home/new/path/in/linux is well the new path in linux
UPDATE Series SET path = replace( path, 'K:', '/home/new/path/in/linux' ) WHERE path LIKE 'K:/%';
# Fix slashes in EpisodeFiles table
UPDATE EpisodeFiles SET RelativePath = replace( RelativePath, '\', '/' ) WHERE RelativePath LIKE '%\%';
@martinbowling
martinbowling / putiodl
Created February 1, 2017 20:45 — forked from neal/putiodl
put.io cli downloader
#!/bin/bash
#
# putiodl - put.io cli downloader
#
# Copyright (C) 2013 Neal <[email protected]>
#
# Dependencies: jq, curl, wget
#
# Make sure ~/.putiodl exists and contains your put.io OAuth token.
#
#!/bin/bash
#requires inotify-tools
#apt-get install inotify-tools
FOLDER="/home/plex/toupload"
inotifywait -m $FOLDER -e create -e moved_to |
while read path action file; do
echo "The file '$file' appeared in directory '$path' via '$action'"
acd_cli ul $FOLDER/"$file" /Media/Unsorted/