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
| function textToZeroWidth (text, encoding = 'utf8') { | |
| const buf = Buffer.from(text, encoding); | |
| return buf.reduce((str, byte) => str + byte.toString(2).padStart(8, '0'), '') | |
| .split('').map((binary) => binary === '0' ? '' : '').join(' '); | |
| }; | |
| function zeroWidthToText (zwChars) { | |
| let message = ''; | |
| const b = zwChars.map((zw) => zw === '' ? '0' : '1').join(''); | |
| for (let x = 0; x < Math.ceil(b.length / 8); x++) { |
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
| #!/usr/bin/python3 | |
| from PIL import Image | |
| NULL = 00000000 | |
| def string_bin(text): | |
| return ''.join(['{:08b}'.format(ord(c)) for c in text]) | |
| def spl_bin(binary): |
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
| #!/usr/bin/env python | |
| from requests import get | |
| from lxml.html import fromstring | |
| from base64 import b64decode | |
| from re import search | |
| def _get_page_content(url): | |
| """ Fetches page content |
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
| #!/bin/env bash | |
| curl -s -d '{"voice": "'"$1"'", "text": "'"$2"'"}' -H "Content-Type: application/json" -H "Context-Type: application/json" https://streamlabs.com/polly/speak | jq -r '.speak_url' | xargs curl -s -0 --output - | ffmpeg -y -i pipe:0 -vn -acodec copy "$3.ogg" |
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
| function selectionSort(array) { | |
| for (var i = 0; i < array.length - 1; i++) { | |
| for (var j = i + 1; j < array.length; j++) { | |
| if (array[i] > array[j]) { | |
| var temp = array[i]; | |
| array[i] = array[j]; | |
| array[j] = temp; | |
| } | |
| } | |
| } |
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
| function bubbleSort(array) { | |
| var swapped = true; | |
| // Iterate until swaps no longer occur | |
| while (swapped) { | |
| // Assume swaps no longer needed | |
| swapped = false; | |
| // Iterate entire array | |
| for (var i = 0; i < array.length; i++) { | |
| var next = array[i - 1]; | |
| var cur = array[i]; |
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
| local SCRIPT_NAME = 'morse' | |
| local SCRIPT_AUTHOR = 'unaffiliated <[email protected]>' | |
| local SCRIPT_VERSION = '1' | |
| local SCRIPT_LICENSE = 'GPL3' | |
| local SCRIPT_DESC = 'Morse code translator' | |
| -- International Morse Alphabet (ITU) | |
| local MORSE = { | |
| a = ".-", | |
| b = "-...", |
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
| # Endpoints for Coinbase API | |
| curl -s https://api.coinbase.com/v2/prices/eth-usd/spot -H 'CB-VERSION: 2015-04-08' | jq -r ".data.amount" | sed -E 's/(.+)/$\1/' | |
| curl -s https://api.coinbase.com/v2/prices/btc-usd/spot -H 'CB-VERSION: 2015-04-08' | jq -r ".data.amount" | sed -E 's/(.+)/$\1/' | |
| # Endpoints for Gemini Ticker API | |
| curl -s https://api.gemini.com/v1/pubticker/ethusd | jq -r 'select(.ask != null)' | sed -E 's/(.+)/$\1/' | |
| curl -s https://api.gemini.com/v1/pubticker/btcusd | jq -r 'select(.ask != null)' | sed -E 's/(.+)/$\1/' |
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
| function checkPalindrome(inputString) { | |
| return inputString === inputString.split('').reverse().join('') | |
| } |
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
| function centuryFromYear(year) { | |
| return year % 100 === 0 ? Math.trunc(year / 100) : Math.trunc(year / 100) + 1 | |
| } |