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 / install-postman.sh
Created February 26, 2023 13:45 — forked from chetanppatil/install-postman.sh
Install Native Postman On Linux
#!/bin/bash
cd /tmp || exit
echo "Downloading Postman ..."
wget -q https://dl.pstmn.io/download/latest/linux?arch=64 -O postman.tar.gz
tar -xzf postman.tar.gz
rm postman.tar.gz
echo "Installing to opt..."
if [ -d "/opt/Postman" ];then
sudo rm -rf /opt/Postman
IN node
use path.resolve("./data/faf")
for cross compatibality of path in windows and linux
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
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
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
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
@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, "")
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
//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
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++)
}
}