Skip to content

Instantly share code, notes, and snippets.

View bboydflo's full-sized avatar
🎯
be nice 👍

Florin Cosmin bboydflo

🎯
be nice 👍
  • Denmark
View GitHub Profile
@bboydflo
bboydflo / redirect-output.sh
Created April 28, 2021 13:03
redirect output command to a file
```sh
# https://dustinpfister.github.io/2020/10/02/linux-redirection/
npm i . &>> output/npmi.log
```
@bboydflo
bboydflo / shell.sh
Created November 10, 2020 10:56
[kill specific port on macos] need to kill a specific port on a mac by its pid? #shell #terminal #bash
# https://stackoverflow.com/a/17703016/1597360
# 1. Find out the process ID (PID) which is occupying the port number (e.g., 5955) you would like to free
sudo lsof -i :5955
# 2. Kill the process which is currently using the port using its PID
sudo kill -9 {PID}
@bboydflo
bboydflo / snippet.sh
Created June 23, 2020 11:07
[count files in a specific folder] count all files from a specific folder from the terminal #shell
# https://hints.macworld.com/article.php?story=20010508182132282
ls | wc -l
@bboydflo
bboydflo / copy.sh
Created May 21, 2020 21:56
[cmd] duplicate file multiple times from #cli
for i in {1..100}; do cp -rvfp file.json copy$i.json ;done
@bboydflo
bboydflo / shell.sh
Created March 11, 2020 11:28
[git rename branch] give a git branch a different name #git #rename
git branch -m <oldname> <newname>
@bboydflo
bboydflo / shell.sh
Created February 13, 2020 08:01
[git add from subfolders] search for files in subdirectories and add the to stagin area
# https://stackoverflow.com/a/11980780/1597360
find . -name '*js' -exec git add {} \;
@bboydflo
bboydflo / shell.sh
Created January 20, 2020 19:44
[macos remove files recursively] when you need to remove all files within a specific folder
# from this so answer: https://stackoverflow.com/a/5061651/1597360
find . -name "*.ts" -exec rm -rf {} \;
@bboydflo
bboydflo / size.sh
Created January 14, 2020 17:10
[find size of all files inside macos directory] #macos #cli
# from here: http://osxdaily.com/2017/03/09/get-size-directory-command-line/
# see the size of the current directory contents
du -sh *
# use the wildcard with other directory paths
du -sh ~/Desktop/*
@bboydflo
bboydflo / run.sh
Last active December 17, 2020 00:42
[Kill node processes] useful in development when we need to all processes of a parent process #nodejs #webdev
killall -9 node
## or
# ps aux | grep node
## then
# kill -9 [pid]
# https://tecadmin.net/kill-process-on-specific-port/
sudo kill -9 $(sudo lsof -t -i:3000)
@bboydflo
bboydflo / debug.css
Last active December 2, 2019 14:16
[Most useful css hack] debugging css #css #webdev
/* https://www.quora.com/What-are-the-most-interesting-HTML-JS-DOM-CSS-hacks-that-most-web-developers-dont-know-about/answer/Gajus-Kuizinas */
/* https://dev.to/gajus/my-favorite-css-hack-32g3?utm_campaign=Alligator.io&utm_medium=email&utm_source=Revue%20newsletter */
* { background-color: rgba(255,0,0,.2); }
* * { background-color: rgba(0,255,0,.2); }
* * * { background-color: rgba(0,0,255,.2); }
* * * * { background-color: rgba(255,0,255,.2); }
* * * * * { background-color: rgba(0,255,255,.2); }
* * * * * * { background-color: rgba(255,255,0,.2); }
* * * * * * * { background-color: rgba(255,0,0,.2); }