Skip to content

Instantly share code, notes, and snippets.

View Git-I985's full-sized avatar
Focusing

Edward Konovalov Git-I985

Focusing
View GitHub Profile
@Git-I985
Git-I985 / m3u8-hls-downloader.sh
Last active January 23, 2023 12:04
m3u8 HSL bash script downloader
#!/bin/bash
# file input.txt must contains *.m3u8 links line by line
# !!! installed ffmpeg required
# You can change/remove Referer if in my case i needed it to bypass blocking requests from another domain
INDEX=1
for file in $(cat ./input.txt)
do
@Git-I985
Git-I985 / qlmanager-with-find-util.fish
Created January 23, 2023 12:07
Recursivly find files by pattern and open them in OSX QuickLook (fish shell version)
qlmanage -p (find ./src/ -type f \( -name "*.png" -o -name "*.svg" -o -name "*.jpeg" -o -name "*.jpg" \))
@Git-I985
Git-I985 / index.js
Created March 4, 2023 22:15
JS nested object access
const get = (obj, keys) =>
!Object.hasOwn(obj, keys[0])
? null
: keys.length === 1
? obj[keys[0]]
: get(obj[keys[0]], keys.slice(1));
export default get
@Git-I985
Git-I985 / index.js
Created March 4, 2023 22:15
JS Words count
export default (_words) => {
const words = _words.split(' ').map(word => word.toLowerCase()).filter(Boolean);
return [...new Set(words)].reduce((acc, word) => ({ ...acc, [word]: words.filter(_word => _word === word).length}), {})
}
@Git-I985
Git-I985 / pick.js
Last active March 6, 2023 12:23
Pick
export default (obj, keysArr) => {
return Object.fromEntries(Object.entries(obj).filter(([key]) => keysArr.includes(key)))
}
@Git-I985
Git-I985 / hash-table.js
Created March 4, 2023 23:09
JS Hash table implementation
// @ts-check
/* eslint-disable no-param-reassign */
import crc32 from 'crc-32';
const collision = (map, key, hash) => map[hash] && key !== map[hash][0]
// BEGIN (write your solution here)
export const get = (map, key, defaultValue = null) => {
const hash = crc32.str(key)
@Git-I985
Git-I985 / dna2rna.js
Created March 4, 2023 23:34
DNA to RNA
// @ts-check
/* eslint no-restricted-syntax: ["off", "ForOfStatement"] */
// BEGIN (write your solution here)
const map = {
G: "C",
C: "G",
T: "A",
A: "U",
}
@Git-I985
Git-I985 / findWhere.js
Created March 6, 2023 12:28
Find where
export default (searchIn, searchVal) => searchIn.find(item => Object.keys(searchVal).every(searchKey => item[searchKey] === searchVal[searchKey])) || null
@Git-I985
Git-I985 / popover.ts
Created May 5, 2023 13:41
Popover feature TypeScript
export enum PopoverPositionType {
VERTICAL,
HORIZONTAL,
}
/**
* @param {Element|String} value
* @returns {Element}
*/
export const getHTMLElementFromArgument = (value): Element => {