This file contains 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
########################################################################################### | |
#################################### Requirements ##################################### | |
# Python version 3.10 and newest(didn't tested on older versions) | |
# pip install python-magic | |
#################################### How does it work ##################################### | |
# Traverses through files in specified directory, checking the metadata of each file: | |
# - if file type is not pdf/docx/doc/txt - REMOVES it, | |
# - if extension file different from the type in metadata(pdf/docx/doc/txt) - RENAMES it. | |
#################################### How to Run ##################################### | |
# 1. save the script to your system. |
This file contains 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
import net from "node:net"; | |
const port_constraints = { | |
min: 1024, | |
max: 65535, | |
}; | |
/** | |
* @param ip Host ip (default localhost) | |
* @param minPort Min available port (default 1024) | |
* @param maxPort Max available port (default 65535) |
This file contains 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/sh | |
set -e | |
if [ -z "$1" ] || ! [ -e "$1" ]; then | |
printf "\e[31mHave nothing from update.\e[0m\n\n" | |
exit 1 | |
fi | |
DEFAULT_VSCODIUM_PATH="/usr/share/vscodium" | |
if [ -z "$2" ] || ! [ -d "$2" ]; then |
This file contains 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 sh | |
trap 'echo "Usage: $0 path/to/folder {copy|replace} \"old_name|new_name\""' 0 | |
export path=${1?"File to path wasn't specified!"};shift | |
export status=${1?"Status wasn't specified!"};shift | |
if [[ -z "$@" ]]; then | |
echo "Name files wasn't specified!" | |
exit 1 | |
else | |
# exmpl "name1part1 name1part2|name2part1 name2part2" |
This file contains 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 sh | |
echo ${1:?Destination path is not specified} | |
export filenames=$(ls -1 $1) | |
export IFS=$'\n' | |
function main () { | |
export previus_href | |
export previus_input |
This file contains 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 sh | |
echo ${1:?Destination path is not specified} | |
export lines=$(cat $1 | egrep '<folder href|<bookmark href') | |
export IFS=$(printf '>') | |
# sed -i 's,link,new-link,g' $1 | |
function main () { | |
for line in $lines; do | |
# echo "Current line>"$line |
This file contains 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
let arr1 = [8,5,9,1,6,0,2] | |
const selectionSort = arr => { | |
for (let i=0;i<arr.length;i++){ | |
let min = i ///// choose first number | |
for (let j=i+1;j<arr.length;j++){ ///// iterate all array | |
if (arr[min] > arr[j]){ | |
min = j ///////////////////// switching indexs if current iteration less current min number | |
} | |
} | |
if (min !== i){ |
This file contains 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
let facrorial = number=>{ | |
let f = 1 | |
let i = 1 | |
while (i<number){ | |
i+=1 | |
f = f*i | |
} | |
return f | |
} | |
let res = facrorial(5) |
This file contains 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
let arrJertva = [5,3,1,2] | |
let bubble_sort = arr=>{ | |
for (let i=1,n=arr.length;i<n;i++) {//make bubble | |
for (let j=1;j<n;j++) { //iterate every element in bubble | |
if (arr[j] < arr[j-1]) { | |
[arr[j],arr[j-1]] = [arr[j-1],arr[j]] // swaping elements if they equally of condition | |
} | |
} | |
} | |
} |
This file contains 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
let arr = [3,4,15,17,20,23,24,31,33,37,40,51,54] | |
function binary_search(a,e){ | |
let high = a.length-1 | |
let mid = 0 | |
let low = 0 | |
while (low <= high) { | |
mid = Math.floor((low+high)/2) | |
if (a[mid] === e){ | |
return arr[mid] | |
}else if (a[mid] < e){ |