To keep the changes from the commit you want to undo
$ git reset --soft HEAD^
To destroy the changes from the commit you want to undo
$ git reset --hard HEAD^
You can also say
import crypto from 'crypto'; | |
import jwt from 'jsonwebtoken'; | |
import { v4 as uuid } from 'uuid'; | |
const secret = 'your-access-token-secret'; | |
console.log('access token secret\n', secret); | |
const refreshTokenSecret = 'your-refresh-token-secret'; | |
console.log('refresh token secret\n', refreshTokenSecret); |
/** | |
* Usage | |
* - npm install loadtest | |
* - npx ts-node load-test.ts | |
*/ | |
import loadtest from 'loadtest'; | |
const method = 'GET'; |
# Usage | |
# 1 - add below snippet on your bashrc/zshrc | |
# 2 - call it by "killport 4000" | |
# 3 - profit | |
killport() { | |
port=$(lsof -n -i4TCP:$1 | grep LISTEN | awk '{ print $2 }') | |
kill -9 $port | |
} |
# rm all files | |
git rm -r --cached . | |
# add all files as per new .gitignore | |
git add . | |
# now, commit for new .gitignore to apply | |
git commit -m ".gitignore is now working" | |
Ref> https://stackoverflow.com/questions/7075923/resync-git-repo-with-new-gitignore-file |
"If you know the contents of the line, this is an ideal use case for: | |
git log -S <string> path/to/file " | |
Reference > https://stackoverflow.com/questions/4404444/how-do-i-git-blame-a-deleted-line |
# To use this, add .nvmrc with contents of 'N.N.N' to your project. e.g. 0.12.7 | |
# Add the following to the end of .bash_profile or .bashrc | |
# | |
# if directory is changed | |
# if `.nvmrc` is found execute `nvm use` | |
# if `package.json` is round execute `nvm use default` | |
enter_directory() { | |
if [ "$PWD" != "$PREV_PWD" ]; then | |
PREV_PWD="$PWD"; | |
if [ -e ".nvmrc" ]; then |
# Find last commit for the deleted file | |
git rev-list -n 1 HEAD -- $path | |
# Checkout the commit before the the delete happened | |
git checkout $commit^ -- $path |
To keep the changes from the commit you want to undo
$ git reset --soft HEAD^
To destroy the changes from the commit you want to undo
$ git reset --hard HEAD^
You can also say
//how to execute: node verify.js <path file that you want to verify> <certificate path> <hash generate by sign.js> | |
//output: true if files are equal, false otherwise. | |
var crypto = require('crypto'); | |
var fs = require('fs'); | |
var args = process.argv.slice(2); | |
var fileName = args[0]; | |
var certPath = args[1]; | |
var sig = args[2]; |
//how to execute: node sign.js <path file> <path private key> | |
//output: signature of file | |
var crypto = require('crypto'); | |
var fs = require('fs'); | |
var args = process.argv.slice(2); | |
var fileName = args[0]; | |
var keyPath = args[1]; | |
//openssl genrsa -out key.pem 1024 |