This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Replace every string to string from string. lol | |
* @param {string} target target string | |
* @param {string} from search value | |
* @param {string} to replace value | |
*/ | |
const replaceAll = (target, from, to) => target.replace(new RegExp(from.replace(/[.*+?^${}()|[\]\\]/g, "\\$&"), "g"), to) | |
// it is same as this. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// One line HEX to RGB. Super fast and human-readable (maybe?) | |
let hex = "#aabbcc"; | |
console.log("Simple one line HEX to RGB", "rgb(" + ['0x' + hex[1] + hex[2] | 0, '0x' + hex[3] + hex[4] | 0, '0x' + hex[5] + hex[6] | 0].join() + ")"); | |
// It can be make like this to support RGBA. | |
let hex1 = "#aabbccdd"; | |
console.log("Simple one line HEX to RGB", "rgba(" + ['0x' + hex1[1] + hex1[2] | 0, '0x' + hex1[3] + hex1[4] | 0, '0x' + hex1[5] + hex1[6] | 0, (hex1[7] ? ('0x' + hex1[7] + hex1[8] | 0) / 255 : 0)].join() + ")"); | |
// To make function... (support #abc, #aabbcc, #aabbccdd) | |
const hexToRgb = function (hex) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#Requires -Version 3 | |
Function Update-CloudFlareDynamicDns | |
{ | |
<# | |
.SYNOPSIS | |
Updates specified CloudFlare DNS hostname to the current connection's external IP address using CloudFlare API v4 | |
https://api.cloudflare.com/ | |
.DESCRIPTION | |
This module is useful for homelabs. Remember how DynDns used to dynamically update your IP address for free? The functionality provided by this module is similar but updates CloudFlare hosted domains. CloudFlare is free and awesome, and I recommend it, if even for its simplified DNS management and free HTTPS. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// This is Chrome Mega extension script that hacked!!! | |
// Version is 3.39.4_0. | |
// You can check it from your comptuer too. | |
// %AppData%\Local\Google\Chrome\User Data\Default\Extensions\bigefpfhnfcobdlfbedofhhaibnlghod\3.39.4_0 | |
// Original mega.js is here. https://github.com/meganz/chrome-extension/blob/master/mega.js | |
function getParameterByName(name, data) { | |
name = name.replace(/[\[\]]/g, '\\$&'); | |
var regex = new RegExp('[?&]' + name + '(=([^&#]*)|&|#|$)'), results = regex.exec(data); | |
if (!results) return ''; |