Skip to content

Latest commit

 

History

History
2258 lines (1511 loc) · 58 KB

all-commands.md

File metadata and controls

2258 lines (1511 loc) · 58 KB

npm i @bgoonz11/repoutils

npm i prettier -g prettier --write .

-----------------------------------------ZIP UTILS----------------------------------------------------------------------------------------- 4.)Recursive-unzip:()===>

find . -name "*.zip" | while read filename; do unzip -o -d "dirname "$filename"" "$filename"; done;

find . -name "*.zip" -type f -print -delete


Install node modules recursevly ( npm i -g recursive-install ):

npm-recursive-install ---------------------------------------------------Main Commands--------------------------------------------------------------------------- find . -empty -type d -print -delete

fdupes -r -f . | grep -v '^$' | xargs rm -v

find . -empty -type f -print -delete

find . -empty -type d -print -delete

find . ( -name ".git" -o -name ".gitignore" -o -name ".gitmodules" -o -name ".gitattributes" ) -exec rm -rf -- {} +

find . ( -name "*SECURITY.txt" -o -name "*RELEASE.txt" -o -name "*CHANGELOG.txt" -o -name "*LICENSE.txt" -o -name "*CONTRIBUTING.txt" -name "*HISTORY.md" -o -name "*LICENSE" -o -name "*SECURITY.md" -o -name "*RELEASE.md" -o -name "*CHANGELOG.md" -o -name "*LICENSE.md" -o -name "*CODE_OF_CONDUCT.md" -o -name "*CONTRIBUTING.md" ) -exec rm -rf -- {} +

find . -name 'node_modules' -type d -prune -exec rm -rf '{}' +

find . -name 'node_modules' -type d -prune -exec rm -rf '{}' +

find . -name 'node-gyp' -type d -prune -exec rm -rf '{}' +

find . -name 'deleteme.txt' -type f -prune -exec rm -rf '{}' +

find . -name 'right.html' -type f -prune -exec rm -rf '{}' +

find . -name 'left.html' -type f -prune -exec rm -rf '{}' +

----------------------------------------------Remove Spaces In File/Folder Names-----------------------------------------------------------

find . -name "* " -type d | rename 's/ /_/g'
find . -name "
*" -type f | rename 's/ /_/g'

find . -name "* *" -type d | rename 's/#/_/g'

find . -name "* *" -type f | rename 's/.html//g' ------------------------------------Truncate folder names down to 12 char------------------------------------------------------------------------

for d in ./*; do mv $d ${d:0:12}; done -------------------------------------Remove Numbers From File Names------------------------------------------------------------------------

find $dir -type f | sed 's|(./)[^a-z]([A-Z].*)|mv "&" "\1\2"|' | sh

find $dir -type d | sed 's|(./)[^a-z]([A-Z].*)|mv "&" "\1\2"|' | sh

for i in .html; do mv "$i" "${i%-}.html"; done

for i in .; do mv "$i" "${i%-}.${i##.}"; done

#!/bin/ksh for i in '.' do echo mv "${i}" "${i##????}" done -------------------------------------FIND AND REPLACE IN STRING/FOLDER NAMES----------------------------------------------------------------

find . -type f -exec rename 's/string1/string2/g' {} +

find . -type d -exec rename 's/-master//g' {} +

rename 's/.js.download$/.js/' *.js.download

rename 's/.html.markdown$/.md/' *.html.markdown

find . -type d -exec rename 's/es6//g' {} +

for d in _.; do tmp=echo $f | sed -r 's//^(.{5})._(\..\*)$/$1$2/' mv -b ./"$f" ./"$tmp" done

rawFileName=$(basename "$1") filename="${rawFileName%.}" ext="${rawFileName##.}"

if [[${#filename} < 9]]; then echo ${filename:0:8}.${ext} else echo $1 fi

rename 's/^(.{10})._/$1/' _

Remove double extensions :

#!/bin/bash

for file in *.html.html do mv "${file}" "${file%.html}" done

#!/bin/bash

for file in *.html.png do mv "${file}" "${file%.png}" done

#!/bin/bash

for file in *.md.md do mv "${file}" "${file%.md}" done

find . -type f -exec rename's/.js.download$/.js/' *.js.download ' {} +

#!/bin/bash num=1 length=16 for file in '.' do newname=$file until [[ ! -f $newname ]] do (( sublen = length - ${#num} )) printf -v newname '%.*s%d' "$sublen" "$file" "$num" (( num++ )) done mv "$file" "$newname" done

sed 's//./././(.)/~/\1/g' *


git pull

git init git add . git commit -m"update" git push -u origin master

git init git add . git commit -m"update" git push -u origin main

git init git add . git commit -m"update" git push -u origin bryan-guner

git init git add . git commit -m"update" git push -u origin gh-pages

git init git add . git commit -m"update" git push -u origin pdf-experiment

git init git add . git commit -m"update" git push -u origin preview


git pull keeping local changes:

git stash git pull git stash pop


clone all of a user's git repositories

CNTX={users}; NAME={johno}; PAGE=1 curl "https://api.github.com/$CNTX/$NAME/repos?page=$PAGE&per_page=100" | grep -e 'git_url*' | cut -d " -f 4 | xargs -L1 git clone

find . -empty -type d -print -delete

find . ( -name ".git" -o -name ".gitignore" -o -name ".gitmodules" -o -name ".gitattributes" ) -exec rm -rf -- {} +

find . ( -name "*SECURITY.txt" -o -name "*RELEASE.txt" -o -name "*CHANGELOG.txt" -o -name "*LICENSE.txt" -o -name "*CONTRIBUTING.txt" -name "*HISTORY.md" -o -name "*LICENSE" -o -name "*SECURITY.md" -o -name "*RELEASE.md" -o -name "*CHANGELOG.md" -o -name "*LICENSE.md" -o -name "*CODE_OF_CONDUCT.md" -o -name "*CONTRIBUTING.md" ) -exec rm -rf -- {} +

CNTX={users}; NAME={jdrichardsappacad}; PAGE=1 curl "https://api.github.com/$CNTX/$NAME/repos?page=$PAGE&per_page=100" | grep -e 'git_url*' | cut -d " -f 4 | xargs -L1 git clone

CNTX={users}; NAME={bgoonz}; PAGE=1 curl "https://api.github.com/$CNTX/$NAME/repos?page=$PAGE&per_page=200"?branch=master | grep -e 'git_url*' | cut -d " -f 4 | xargs -L1 git clone

CNTX={organizations}; NAME={johno}; PAGE=1 curl "https://api.github.com/$CNTX/$NAME/repos?page=$PAGE&per_page=200"?branch=master | grep -e 'git_url*' | cut -d " -f 4 | xargs -L1 git clone

Clone Orginization:

#!/bin/bash for i in $(curl "https://api.github.com/orgs/freeCodeCamp/repos" | grep -oP '"clone_url":\s*"\K[^"]+'); do echo git clone "$i" done

Clone Orginization:

#!/bin/bash for i in $(curl "https://api.github.com/orgs/mdn/repos" | grep -oP '"clone_url":\s*"\K[^"]+'); do echo git clone "$i" done

#!/bin/bash for i in $(curl "https://api.github.com/orgs/react-component/repos" | grep -oP '"clone_url":\s*"\K[^"]+'); do echo git clone "$i" done

#!/bin/bash for i in $(curl "https://api.github.com/orgs/stackbit-themes/repos" | grep -oP '"clone_url":\s*"\K[^"]+'); do echo git clone "$i" done


tree -d -I 'node_modules'

tree -I 'node_modules'

tree -f -I 'node_modules' >TREE.md

tree -f -I 'node_modules' >listing-path.md

tree -f -I 'node_modules' -d >TREE.md

tree -f >README.md

full path: tree -f ~/


find . -name *right.html -type f -exec sed -i 's/target="_parent"//g' {} +

find . -name *right.html -type f -exec sed -i 's/target="_parent"//g' {} +

sudo npm i prettier -g

prettier --write .

"pretty": "prettier --write "./*/.{js,jsx,py,md,html,css}""

Format Python:

black .


                                     PANDOC

find ./ -iname "*.md" -type f -exec sh -c 'pandoc --standalone "${0}" -o "${0%.md}.html"' {} ;

find ./ -iname "*.html" -type f -exec sh -c 'pandoc --wrap=none --from html --to markdown_strict "${0}" -o "${0%.html}.md"' {} ;

find ./ -iname "*.docx" -type f -exec sh -c 'pandoc "${0}" -o "${0%.docx}.md"' {} ;


Remove lines contaning string:

sudo sed -i '/githubusercontent/d' ./*sandbox.md

sudo sed -i '/github.com/d' ./*out.md

sudo sed -i '/author/d' ./*

<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/js/bootstrap.min.js" integrity="sha384-j0CNLUeiqtyaRmlzUHCPZ+Gy5fQu0dQ6eZ/xAww941Ai1SxSY+0EQqNXNE6DZiVc" crossorigin="anonymous"></script>

https://bgoonz-blog.netlify.app/

<iframe id="inlineFrameExample" title="Inline Frame Example" frameborder="no" loading="lazy" allowtransparency="true" allowfullscreen="true" width="800" height="800" src="https://deploy-preview-5--jolly-austin-0c1a1d.netlify.app/organizer"> </iframe>

https://replit.com/@bgoonz/Data-Structures-Algos-Codebase

https://repl.it/@bgoonz/Data-Structures-Algos-Codebase?lite=true&amp;referrer=https%3A%2F%2Fbryanguner.medium.com

https://repl.it/@bgoonz/node-db1-project?lite=true&amp;referrer=https%3A%2F%2Fbryanguner.medium.com

https://repl.it/@bgoonz/interview-prac?lite=true&amp;referrer=https%3A%2F%2Fbryanguner.medium.com

https://repl.it/@bgoonz/Database-Prac?lite=true&amp;referrer=https%3A%2F%2Fbryanguner.medium.com

https://replit.com/@bgoonz/express-sqlite-app#src/routes/indexRoute.js https://replit.com/@bgoonz/SQLite-starter-Template-Jam#main.sql

sudo sed -i '/stargazers/d' ./repo.txt sudo sed -i '/node_modules/d' ./index.html sudo sed -i '/right.html/d' ./index.html sudo sed -i '/right.html/d' ./right.html


zips directory excluding .git and node_modules all the way down (linux)

#!/bin/bash TSTAMP=date '+%Y%m%d-%H%M%S' zip -r $1.$TSTAMP.zip $1 -x "**.git/*" -x "**node_modules/*" shift; echo $@;

printf "\nCreated: $1.$TSTAMP.zip\n"

usage:

- zipdir thedir

- zip thedir -x "*anotherexcludedsubdir/" (important the double quotes to prevent glob expansion)

if in windows/git-bash, add 'zip' command this way:


Delete files contaning a certain string:

find . | xargs grep -l www.redhat.com | awk '{print "rm "$1}' > doit.sh vi doit.sh // check for murphy and his law source doit.sh


------------------------------------------------GIT--------------------------------------------------------- ------------------------------------------------GIT--------------------------------------------------------- ------------------------------------------------GIT---------------------------------------------------------

git filter-branch --index-filter 'git rm -r --cached --ignore-unmatch assets/_index.html' HEAD


OVERWRITE LOCAL CHANGES:

Important: If you have any local changes, they will be lost. With or without --hard option, any local commits that haven't been pushed will be lost.[*] If you have any files that are not tracked by Git (e.g. uploaded user content), these files will not be affected.

First, run a fetch to update all origin/ refs to latest:

git fetch --all Backup your current branch:

git branch backup-master Then, you have two options:

git reset --hard origin/master OR If you are on some other branch:

git reset --hard origin/<branch_name> Explanation: git fetch downloads the latest from remote without trying to merge or rebase anything.

Then the git reset resets the master branch to what you just fetched. The --hard option changes all the files in your working tree to match the files in origin/master

Remove Submodules:

git submodule deinit

-------------------------------GET GISTS:

wget -q -O - https://api.github.com/users/bgoonz/gists | grep raw_url | awk -F" '{print $4}' | xargs -n3 wget

wget -q -O - https://api.github.com/users/drodsou/gists | grep raw_url | awk -F" '{print $4}' | xargs -n1 wget

wget -q -O - https://api.github.com/users/thomasmb/gists | grep raw_url | awk -F" '{print $4}' | xargs -n1 wget

wget -q -O - https://api.github.com/users/koraktor/gists | grep raw_url | awk -F" '{print $4}' | xargs -n1 wget

watch -n '100' "git pull && (git ls-files --modified --others --exclude-standard | grep . > /dev/null) && { git add . ; git commit -m '' ; git push; }"


git remote remove origin


just clone .git folder:

git clone --bare --branch=master --single-branch https://github.com/bgoonz/My-Web-Dev-Archive.git

Undo recent pull request: git reset --hard master@{"10 minutes ago"}


Open PowerShell and enter wslconfig.exe /l to confirm WSL is installed correctly and list the currently available Linux distributions within your system. Confirm a valid distribution has (default) next to it. To change the default distribution, enter wslconfig.exe /setdefault "distributionNameAsShownInList" The terminal not working when running the 32-bit Windows client on 64-bit Windows?# The easy fix for this issue is to use the 64-bit version. If you must use the 32-bit version, you need to use the sysnative path when configuring your shell path instead of System32. Adding this setting should fix the issue:

"terminal.integrated.shell.windows": "C:\Windows\Sysnative\cmd.exe",

To remove a submodule you need to:

Delete the relevant section from the .gitmodules file. Stage the .gitmodules changes git add .gitmodules Delete the relevant section from .git/config. Run git rm --cached path_to_submodule (no trailing slash). Run rm -rf .git/modules/path_to_submodule (no trailing slash). Commit git commit -m "Removed submodule " Delete the now untracked submodule files rm -rf path_to_submodule ----------------------------------------Lebab----------------------------------------------------------------- safe:

lebab --replace ./ --transform arrow lebab --replace ./ --transform arrow-return lebab --replace ./ --transform for-of lebab --replace ./ --transform for-each lebab --replace ./ --transform arg-rest lebab --replace ./ --transform arg-spread lebab --replace ./ --transform obj-method lebab --replace ./ --transform obj-shorthand lebab --replace ./ --transform multi-var

ALL:

lebab --replace ./ --transform obj-method lebab --replace ./ --transform class lebab --replace ./ --transform arrow lebab --replace ./ --transform let lebab --replace ./ --transform arg-spread lebab --replace ./ --transform arg-rest lebab --replace ./ --transform for-each lebab --replace ./ --transform for-of lebab --replace ./ --transform commonjs lebab --replace ./ --transform exponent lebab --replace ./ --transform multi-var lebab --replace ./ --transform template lebab --replace ./ --transform default-param lebab --replace ./ --transform destruct-param lebab --replace ./ --transform includes lebab --replace ./ --transform obj-method lebab --replace ./ --transform class lebab --replace ./ --transform arrow lebab --replace ./ --transform arg-spread lebab --replace ./ --transform arg-rest lebab --replace ./ --transform for-each lebab --replace ./ --transform for-of lebab --replace ./ --transform commonjs lebab --replace ./ --transform exponent lebab --replace ./ --transform multi-var lebab --replace ./ --transform template lebab --replace ./ --transform default-param lebab --replace ./ --transform destruct-param lebab --replace ./ --transform includes


---------------------------------------Trouble Shooting------------------------------------------------------------------ input/Output error

wsl.exe --shutdown Get-Service LxssManager | Restart-Service


Fudge2312!

IP: 173.70.97.51

Log into postgres: sudo -u postgres psql -------------------------------------------------------------Symbolic Link-------------------------------------------- sudo ln -s ./mnt/c/MY-WEB-DEV

ln -s "$(pwd)" ~/NameOfLink

ln -s "$(pwd)" ~/Downloads

return to bash from zsh sudo apt --purge remove zsh

----------------Unzip PowerShell UNZIP: PARAM ( [string] $ZipFilesPath = "./", [string] $UnzipPath = "./RESULT" )

$Shell = New-Object -com Shell.Application $Location = $Shell.NameSpace($UnzipPath)

$ZipFiles = Get-Childitem $ZipFilesPath -Recurse -Include *.ZIP

$progress = 1 foreach ($ZipFile in $ZipFiles) { Write-Progress -Activity "Unzipping to $($UnzipPath)" -PercentComplete (($progress / ($ZipFiles.Count + 1)) * 100) -CurrentOperation $ZipFile.FullName -Status "File $($Progress) of $($ZipFiles.Count)" $ZipFolder = $Shell.NameSpace($ZipFile.fullname)

$Location.Copyhere($ZipFolder.items(), 1040) # 1040 - No msgboxes to the user - http://msdn.microsoft.com/en-us/library/bb787866%28VS.85%29.aspx
$progress++

}

cat w07_data-structures-and-algorithms.md* | codedown javascript > code.js

cat README.md* | codedown javascript > code.js cat interview Questions.md* | codedown javascript > code.js cat README.md* | codedown javascript > code.js

cat w08_getting-to-know-the-network.html* | codedown javascript > code.js

cat *.html | codedown javascript > code.js

cat *.markdown | codedown javascript > code.js

----------------------------------auto generate readme-----------------------------------------------------------------------

rename existing readme to blueprint.md

npx @appnest/readme generate


npm i -g mdt-docs-generator

RENAME README.md ===> README_RAW.md

mdt-docs

---------------------------------Export Medium as Markdown------------------------------------------------------------------------

mediumexporter https://medium.com/codex/fundamental-data-structures-in-javascript-8f9f709c15b4 >ds.md

-------------------------Delete within size range--------------------------------------------------------------------------------

find . -size +386b -a -size -390b -exec rm -f {} ;

find . -size +2000b -exec rm -f {} ;


Create symbolic link to working directory

ln -s "$(pwd)" ~/mylink

npm install redux-logger redux-thunk styled-components



find -type f -exec sed -i 's///g' {} +

find . -type f -exec rename 's/-master//g' {} +

find . -type f -exec rename 's/-theme//g' {} +

find . -type f -exec rename 's/-free//g' {} +

INSTEAD OF GIT PUSH _F :git reset --hard upstream/master

TRIM ALL(USE WITH CAUTION): find . -depth -exec rmdir {} ;
find . -empty -type f -print -delete find . -empty -type d -print -delete

find . ( -name ".git" -o -name ".gitignore" -o -name ".gitmodules" -o -name ".gitattributes" ) -exec rm -rf -- {} +

find . ( -name "*SECURITY.txt" -o -name "*RELEASE.txt" -o -name "*CHANGELOG.txt" -o -name "*LICENSE.txt" -o -name "*CONTRIBUTING.txt" -name "*HISTORY.md" -o -name "*LICENSE" -o -name "*SECURITY.md" -o -name "*RELEASE.md" -o -name "*CHANGELOG.md" -o -name "*LICENSE.md" -o -name "*CODE_OF_CONDUCT.md" -o -name "*CONTRIBUTING.md" ) -exec rm -rf -- {} +

find . ( -name "*SECURITY.txt" -o -name "*RELEASE.txt" -o -name "*CHANGELOG.txt" -o -name "*LICENSE.txt" -o -name "*CONTRIBUTING.txt" -name "*HISTORY.md" -o -name "*LICENSE" -o -name "*SECURITY.md" -o -name "*RELEASE.md" -o -name "*CHANGELOG.md" -o -name "*LICENSE.md" -o -name "*CODE_OF_CONDUCT.md" -o -name "*CONTRIBUTING.md" ) -exec rm -rf -- {} +


Replace spaces in filenames with underscores

for file in *; do mv "$file" echo $file | tr ' ' '_' ; done



Netlify error: 1:32:52 AM: Error checking out submodules: fatal: No url found for submodule path '2-content/awesome-resources/Cumulative-Resource-List-master' in .gitmodules

git rm --cached 2-content/awesome-resources/Cumulative-Resource-List-master



find . -name "*right.md" -type f -print -delete

find . -name "*right.html" -type f -print -delete

find . -name "*analytics.js" -type f -print -delete

find . -name "*.zip" | while read filename; do unzip -o -d "dirname "$filename"" "$filename"; done;

find . -name "*desktop.ini" -type f -print -delete

find . -name "*.zip" -type f -print -delete

find ./ -type f -name *.tar.gz -exec tar -xf {} ;

git remote remove origin

find . -name "*.gz" -type f -print -delete dac9ba0

find . -name "*.tgz" -type f -print -delete

lebab --replace ./ --transform obj-method lebab --replace ./ --transform class lebab --replace ./ --transform arrow lebab --replace ./ --transform let lebab --replace ./ --transform arg-spread lebab --replace ./ --transform arg-rest lebab --replace ./ --transform for-each lebab --replace ./ --transform for-of lebab --replace ./ --transform commonjs lebab --replace ./ --transform exponent lebab --replace ./ --transform multi-var lebab --replace ./ --transform template lebab --replace ./ --transform default-param lebab --replace ./ --transform destruct-param lebab --replace ./ --transform includes

lebab --replace ./ --transform obj-method lebab --replace ./ --transform class lebab --replace ./ --transform arrow

lebab --replace ./ --transform arg-spread lebab --replace ./ --transform arg-rest lebab --replace ./ --transform for-each lebab --replace ./ --transform for-of lebab --replace ./ --transform commonjs lebab --replace ./ --transform exponent lebab --replace ./ --transform multi-var lebab --replace ./ --transform template lebab --replace ./ --transform default-param lebab --replace ./ --transform destruct-param lebab --replace ./ --transform includes


PRISM:

<script async defer src="https://cdn.jsdelivr.net/gh/bgoonz/GIT-CDN-FILES/misc/web-dev-utils/personal-utilities/prism/prism.js"></script>

Powershell unzip:

$folderPath="PWD";

Get-ChildItem $folderPath -recurse | %{

if($_.Name -match "^*.`.zip$")
{
    $parent="$(Split-Path $_.FullName -Parent)";
    write-host "Extracting $($_.FullName) to $parent"

    $arguments=@("e", "`"$($_.FullName)`"", "-o`"$($parent)`"");
    $ex = start-process -FilePath "`"C:\Path\To\7zip\7z.exe`"" -ArgumentList $arguments -wait -PassThru;

    if( $ex.ExitCode -eq 0)
    {
        write-host "Extraction successful, deleting $($_.FullName)"
        rmdir -Path $_.FullName -Force
    }
}

}


<iframe width="560" height="315" src="https://www.youtube.com/embed/xGZSWvFess8?start=2" title="YouTube video player" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture" allowfullscreen></iframe>

find ./ -iname "*.md" -type f -exec sh -c 'pandoc --standalone "${0}" -o "${0%.md}.html"' {} ;

for f in *.html; do printf '%s\n' 0a '

<title>Document</title> <script async defer src="./prism.js"></script> ;' . x | ex "$f"; done echo "" | tee -a *.html

------------------------------------Concat all files of same type recursively---------------------------------------------------------------------

find /path/to/directory/ -name *.csv -exec cat {} + > merged.file

find './' -name *.html -print0 | xargs -0 -I file cat file > merged.file.html

pandoc *.md > final.md

find . -name *.html -exec cat {} + > merged.file.html

find . -name *.md -exec cat {} + > merged.file.md

find . -name *.html -exec cat {} + > merged.file.html

for f in *.html; do cat "${f}"; echo; done > output.html

for f in *.js; do cat "${f}"; echo; done > output.js


Flatten all sub folders into one folder contaning files.

find ./ -mindepth 1 -type f -exec mv -t ./ --backup=t '{}' +


find . -type f -exec sed -i '/Mirrored from/d' ./*.html {} ;

find . -type f -exec sed -i '/path/d' ./scrap.md {} ;

sudo sed -i '/description/d' *.html

sudo sed -i '/WEEK-/d' README.html

sudo sed -i '/// Date :/d' *.js

find . -type f -exec sed -i '/Created by/d' ./*.html {} ;

find . -type f -exec sed -i '/Mirrored from/d' ./*.md {} ;

find . -type f -exec sed -i '/image004/d' ./*.html {} ;

find . -type f -exec sed -i '/:::/d' ./*.md {} ;

find . -type f -exec sed -i '/authors/d' ./*. {} ;

find . -type f -exec sed -i '/section:/d' ./*. {} ;

find . -type f -exec sed -i '/ Created by /d' ./*.html {} ;

find . -type f -exec sed -i '/

Document generated by Confluence on/d' ./*.html {} ;

find . -type f -exec sed -i '/