Skip to content

Instantly share code, notes, and snippets.

View ubermachine's full-sized avatar
💭
when in doubt use bash

Shivam katoch ubermachine

💭
when in doubt use bash
View GitHub Profile
@ubermachine
ubermachine / gitignore_reset.txt
Created June 11, 2020 15:23
Remove previously commited Files after initializing .gitignore
#Add .gitignore file and update it then do this-
git rm -r --cached .
git add .
git commit -m "remove gitignore files"
git push
function range(start,end) {
if(start&&end){
return Array.from({length:end-start+1},(_,i)=>start++)
}
}
range(3,8);
function range(start,end) {
if(start&&end){
return Array.from({length:end-start+1},(_,i)=>start++)
}
else{
return function range2(end){
return Array.from({length:end-start+1},(_,i)=>start++)
}
}
//Clearly Parsing occurs before execution else "greeting" should have consoled same is reason behind for Hoisting
var greeting = "Hi";
console.log(greeting);
greeting = ."Hello"; //Syntax error is thrown first
Redirections, Pipes and Signals
Managing streams
These are the redirectors that we can use to take control of the streams of our programs
command > file: redirects standard output, overwrites file
command >> file: redirects standard output, appends to file
command < file: redirects standard input from file
command 2> file: redirects standard error to file
command1 | command2: connects the output of command1 to the input of command2
@ubermachine
ubermachine / FixurlSHit.js
Created January 18, 2021 17:28
Fix url %E2%80%8B
https.get('https://www.bs.com/dfsd/fsdf/d​-quotes'.replace(/[^\x00-\x7F]/g, "")
git config --global color.ui auto
Advanced Git Cheat Sheet
git commit -a Stages files automatically
git log -p Produces patch text
git show Shows various objects
git diff Is similar to the Linux `diff` command, and can show the differences in various commits
git diff --staged An alias to --cached, this will show all staged files compared to the named commit
git add -p Allows a user to interactively review patches to add to the current commit
git mv Similar to the Linux `mv` command, this moves a file
ps ax|less #show running processes search process using /process name
kill unresponsive programs
pidof PROGRAMNAME
kill $pidof
OR even better
kill $(pidof konsole)
eve better if killall node works
nice and renice to check/change priority
All list of tools related to system performance http://www.brendangregg.com/linuxperf.html
To check how much time a process is taking to finish
Go to the folder open terminal
On node
sudo http-server -a 0.0.0.0 -p 889
On python
sudo python -m http.server 889
wget -r -np -nH --cut-dirs=3 -R index.html http://hostname:port
Explanation:
It will download all files and subfolders in ddd directory
-r : recursively
-np : not going to upper directories, like ccc/…
-nH : not saving files to hostname folder
--cut-dirs=3 : but saving it to ddd by omitting first 3 folders aaa, bbb, ccc
-R index.html : excluding index.html files