Giter VIP home page Giter VIP logo

gists-2022's Introduction

import os import shutil from os.path import * # just to avoid typing "os.path." everywhere

I am using abspath() here to get the absolute path to the folder.

folder = abspath(input('Enter the main folder: '))

index through all elements in the main folder that are directories

for subfolder in os.listdir(folder): abs_subfolder = join(folder, subfolder) # get the folder's absolute path if not isdir(abs_subfolder): continue # go to the next element because this one wasn't a folder

# index through all the files in this subfolder
for file in os.listdir(abs_subfolder):
    # get the extension of the file to move
    extension = splitext(file)[1]

    new_file_path = abs_subfolder + '.' + extension

    # move the file to its parent directory, and change its name
    shutil.move(join(abs_subfolder, file), new_file_path)

# delete the directory the files were in
# you can comment the next line if you don't want that to happen
os.rmdir(abs_subfolder)

"C:\Users\bryan\AppData\Local\Microsoft\WindowsApps\ubuntu.exe" \Users\bryan\AppData\Local\Microsoft\WindowsApps\CanonicalGroupLimited.Ubuntu20.04onWindows_79rhkp1fndgsc\ubuntu2004.exe

----------------------BACKUP----------------https://gist.github.com/bgoonz/4adfdda0141e1a9e99cfb49983cd32c9------------------------------ -------------------------Authenticate with access token-------------------------------------------------------------------------------- access-token: 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 git remote set-url origin https://bgoonz:[email protected]/bgoonz/lebab-webview.git git remote add origin https://bgoonz:[email protected]/bgoonz/lebab-webview.git

---------------------------------------------Produce Documentation------------------------------------------------------------ docky src//*.js \ --watch "src/components//*.js","./README.md" \ --ignore "src/components/**/index.js" \ ignored files --use-readme=false ----------------------------------------------Remove remote origin-----------------------------------------------------------

git remote remove origin

See More

CNTX={users}; NAME={oreillymedia}; PAGE=4 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


wget -r -A.pdf https://ocw.mit.edu/courses/electrical-engineering-and-computer-science/6-006-introduction-to-algorithms-fall-2011/lecture-notes/


npm i @bgoonz11/repoutils npm i prettier -g prettier --write .


Trim folder names or file names rename 's/^(.{10})./$1/'


---------------------------------------------------Main Commands--------------------------------------------------------------------------- find . -empty -type d -print -delete OR find . -depth -exec rmdir {} ;

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

-----------------------------------------------Git workflow---------------------------------------------------------- git add . && git commit -m "update good" && git push -u origin master


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 '__MACOSX' -type d -prune -exec rm -rf '{}' +

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

find . -size +98M -a -print -a -exec rm -f {} ;

--------------------------------------------Remove lines of file contaning a string------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

sudo sed -i '/Mirrored from/d' ./.html sudo sed -i '/This is Squarespace/d' ./.html sudo sed -i '/authors/d' ./*.md sudo sed -i '/assets/d' ./index.html

---------------------------------------------To find a pattern and remove the line containing the pattern below command can be used---------------------------------------------------------------------------------------------------------------------- find . -name "*" -type f | xargs sed -i -e '/Mirrored from/d'

find . -name '' -type f | xargs sed -i -e '/Author/d' find . -name "" -type f | xargs sed -i -e '/author/d'


npm i --legacy-peer-deps

---------Flatten (denest) all sub folders into one folder contaning files.---------------------------------------------

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


-----------------------------------------------Download all of a users repos----------------------------------------------------------

twbs

curl -s https://api.github.com/orgs/NHQ/repos | grep "clone_url" | awk '{print $2}' | sed -e 's/"//g' -e 's/,//g' | xargs -n1 git clone

curl -s https://api.github.com/users/sokra/repos | grep "clone_url" | awk '{print $2}' | sed -e 's/"//g' -e 's/,//g' | xargs -n1 git clone

----------------------------------------Make on a timer-----------------------------------------------------------------

while sleep 25; do make; done

while sleep 25; do git add . && git commit -m "update good" && git push -u origin master ; done

while sleep 25; do git push ; done

while sleep 25; do prettier --write .; done

while sleep 25; do black .; done

while sleep 25; do find . ( -name ".git" -o -name ".gitignore" -o -name ".gitmodules" -o -name ".gitattributes" ) -exec rm -rf -- {} +; done

while sleep 205; do find . ( -name ".git" -o -name ".gitignore" -o -name ".gitmodules" -o -name ".gitattributes" ) -exec rm -rf -- {} +; done


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

-----------------------------------------COMBINE ALL FILES OF A CERTAIN TYPE----------------------------------------------------------------

for f in *.md; do cat "${f}"; echo; done > ./../Combined**_-_**Doc.md

for f in *.js; do cat "${f}"; echo; done > Combined**_-_**Doc.md

for f in *.js; do cat "${f}"; echo; done > ./../Combined**_-_**Doc.md

for f in *.jsx; do cat "${f}"; echo; done > Combined**_-_**Doc.md

for f in *.py; do cat "${f}"; echo; done > Combined**_-_**Doc.md

-----------------------------------------------------------Github Corner--------------------------------------------------------------

-------------------------------------------WGET DOWNLOAD WEBSITE--------------------------------------------------------------

wget --limit-rate=200k --no-clobber --convert-links --random-wait -r -p -E -e robots=off -U mozilla https://bryan-guner.gitbook.io/my-docs/

wget --limit-rate=200k --no-clobber --convert-links --random-wait -r -p -E -e robots=off -U mozilla https://linktr.ee/ToxicFreeSimplyClean


sudo sed -i '/authors/d' ./*.md

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

---------Delete files with certain string in name------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

find -type f -name 'text' -delete

find -type d -name 'Learning-Path' -delete

-----------------------------------------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

find . -name '*robots.txt' -type d -prune -exec rm -rf '{}' +


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

npm-recursive-install

---------------------------------------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"' {} ;

find . -name '*.rst' -exec pandoc {} -f rst -t markdown -o {}.md ;

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

for /R %a in (.htm) do pandoc “%a” -f html -t latex -s -o “%~pa%~na.pdf”

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


-------------------------------------------------------------Symbolic Link-------------------------------------------- sudo ln -s ./mnt/c/MY-WEB-DEV

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

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

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

find . -name 'sitemap.md' -type f -prune -exec rm -rf '{}' +


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 gh-pages

git init git remote add origin https://github.com/Archive-42/september-downloads-archive.git git add . git commit -m"update" git push -u origin master

------------------------------------Embed Repl.it---------------------------------------------

<iframe frameborder="0" width="100%" height="500px" src=" ?lite=true"></iframe> <iframe frameborder="0" width="100%" height="500px" src="https://replit.com/@bgoonz/Medium-article-comp-complex?lite=true"></iframe> <iframe frameborder="0" width="100%" height="500px" src="https://replit.com/@ritza/demo-embed?light="true"&&embed=true"></iframe>

<iframe frameborder="0" width="100%" height="800px" src=" "></iframe>

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

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

find . -name 'nav-index' -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 '{}' +

-----------------------------delete files contaning certain numbers-------------caution-dangerous---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

find . -name '.zip' -type f -prune -exec rm --[12345]'{}' + find . -name '.png' -type f -prune -exec rm -- [123456789] '{}' +

find . -name '.png' -type f -prune -exec rm --[45]* '{}' +

----------------------------------------------Delete files smaller thatn 2k-----------------------------------------------------------

find . -name "*.js" -type 'f' -size -2k -delete

find . -name "*.py" -type 'f' -size -2k -delete

find . -name "*.md" -type 'f' -size -2k -delete

find . -name "*.html" -type 'f' -size -2k -delete

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

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

!/bin/bash

dir=''

IFS=' ' for f in $(find $dir * -type f) ; do mv "$f" "echo $f | sed 's/^[0-9]*\W*//'"; done

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

-------------------------------------Find and replace file names--------------------------------------------------------------------

find . -name "**" -type f | rename 's/sitemap/index/g'

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

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

find . -name "*" -type d | rename 's/#/_/g' find -type f -name "~*" -execdir rename -n -v 's/#//' {} +

find . -name "**" -type f | 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------------------------------------------------------------------------

!/bin/bash

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

!/bin/bash

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

Remove double extensions :

!/bin/bash

for file in *.html.html do mv "${file}" "${file%.html}" 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' {} +

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

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

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

find . -type d -exec rename 's/-main//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

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

!/bin/bash

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

!/bin/bash

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

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

!/bin/bash

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

find . -type f -exec ' {} +

!/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' *


RUN GIT FLOW EVERY 2 MINUTES:

while sleep 120; do git init && git add . && git commit -m "update" && git push -u origin master; done

OR:

while sleep 25; do make; done



Clone Only .git folder:

git clone --no-checkout https://github.com/bgoonz/UsefulResourceRepo2.0.git



find . -size +100k -delete

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 imgbot

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:

CNTX={users|orgs}; NAME={username|orgname}; 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={NHQ}; 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={NHQ}; PAGE=2 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={NHQ}; PAGE=3 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|orgs}; NAME={username|orgname}; 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={orgs}; NAME={w3c}; 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={orgs}; NAME={Archive-42}; 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={orgs}; NAME={octokit}; 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={orgs}; NAME={FreeCodeCamp-Solutions}; 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={orgs}; NAME={netlify-templates}; 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={orgs}; NAME={circlecell}; 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={orgs}; NAME={circlecell}; 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={decagondev}; 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


tree -d -I 'node_modules'

tree -I 'node_modules'

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

tree -f -L 2 >README.md

tree -f -L 3 -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 . prettier --write "./*/.{js,jsx,py,md,html,css}"

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

Format Python:

black .

----------------------------------------Remove lines contaning string:----------------------------------------------------- sudo sed -i '/githubusercontent/d' ./*.md

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

sudo sed -i '/tip-tldrt/d' ./*scrap2.md

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

sudo sed -i '/New folder/d' ./bookmarks.md

---------------------------------MEDIUM EMBED----------------------------------------------------

https://replit.com/@bgoonz/js-tutorial#02.%20Introducing%20JavaScript/02.01.js.intro.html

https://replit.com/@bgoonz/data-structures?lite=true&amp;referrer=https%3A%2F%2Fbryanguner.medium.com

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

https://repl.it/@bgoonz/js-tutorial-1?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


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

https://stackoverflow.com/a/55749636/1482990


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---------------------------------------------------------

-------------------------------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/remy/gists | grep raw_url | awk -F" '{print $4}' | xargs -n3 wget

wget -q -O - https://api.github.com/users/r-sal/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----------------------------------------------------------------- LEBAB

npm i lebab -g

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

---------------------When you only clone .git folder------------------------------------------------------------------------------------

git restore --source=HEAD :/


When resolving a peer dependency that has a ">=" in it's version, npm uses the latest version of that package to compare with the current dependency version in the package.json.

In this case: npm is looking for react 17, while react 16.13 is also a version that is suits >=16.9.0

npm i --legacy-peer-deps


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 js-snippets.md*| codedown js > code.js cat interview Questions.md* | codedown javascript > code.js cat README.md* | codedown js > 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 d -exec rename 's/-master//g' {} +

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

4895

To display the current branch you're on, without the other branches listed, you can do the following:

git rev-parse --abbrev-ref HEAD

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



wget --limit-rate=200k --no-clobber --convert-links --random-wait -r -p -E -e robots=off -U mozilla https://bryan-guner.gitbook.io/python/

wget --limit-rate=200k --no-clobber --convert-links --random-wait -r -p -E -e robots=off -U mozilla https://www.notion.so/webdevhub42/72b1342736094af4bd0992bad4dd2267?v=7f80269e29ee4a79a8227187cbf69c39

https://i.imgur.com/i6VDHcd.png

https://bryan-guner.gitbook.io/my-docs/

https://i.imgur.com/i6VDHcd.png

wget --limit-rate=200k --no-clobber --convert-links --random-wait -r -p -E -e robots=off -U mozilla https://blog.archive.org/developers/

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

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

find . -name "*left.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


PUSH IN CHUNCKS: REMOTE=origin BRANCH=$(git rev-parse --abbrev-ref HEAD) BATCH_SIZE=10

check if the branch exists on the remote

if git show-ref --quiet --verify refs/remotes/$REMOTE/$BRANCH; then

# if so, only push the commits that are not on the remote already

range=$REMOTE/$BRANCH..HEAD

else

# else push all the commits

range=HEAD

fi

range=HEAD

echo "Range: $r"

count the number of commits to push

n=$(git log --first-parent --format=format:x $range | wc -l)

echo "Commits to push: $n"

push each batch

for i in $(seq $n -$BATCH_SIZE 1); do # get the hash of the commit to push h=$(git log --first-parent --reverse --format=format:%H --skip $i -n1) echo "Pushing $h..." git push $REMOTE $h:refs/heads/$BRANCH --force done

push the final partial batch

git push $REMOTE HEAD:refs/heads/$BRANCH


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
    }
}

}


------------------------------------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

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

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

pandoc *.md > final.md

pandoc *.py > final.md

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

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

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 *.py; do cat "${f}"; echo; done > output.md

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

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


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

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

find . -type f -exec sed -i '/#/' ./*quandstack.py {} ;

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

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 '/

gists-2022's People

Contributors

bgoonz avatar renovate-bot avatar

Stargazers

 avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.