Skip to content

Instantly share code, notes, and snippets.

View blpabhishek's full-sized avatar
💭
Working

Abhishek Gupta blpabhishek

💭
Working
View GitHub Profile
@blpabhishek
blpabhishek / bashrc
Created March 2, 2017 15:04
bash - profile
export CLICOLOR=1
export LSCOLORS=Gxfxcxdxbxegedabagacad
[[ -f $HOME/.dircolors ]] && eval $(dircolors -b $HOME/.dircolors)
if $_isxrunning; then
[[ -f $HOME/.dircolors_256 ]] && eval $(dircolors -b $HOME/.dircolors_256)
export TERM='xterm-256color'
@blpabhishek
blpabhishek / ftpserver.sh
Created July 17, 2017 13:56
Starting FTP Server on macOS Sierra
# Start FTP Server
launchctl load -w /System/Library/LaunchDaemons/ftp.plist
# Stop FTP Server
launchctl unload -w /System/Library/LaunchDaemons/ftp.plist
@blpabhishek
blpabhishek / git-merge.sh
Created July 31, 2017 11:52
Merge two unrelated git repositories
# merge project-a to a project-b with all the history
cd path/to/project-b
git remote add project-a path/to/project-a
git fetch project-a
git merge --allow-unrelated-histories project-a/master
git remote remove project-a
git add .
git commit -m <message>
@blpabhishek
blpabhishek / switch-off.sh
Created February 16, 2018 11:15
Switch off the network in every three hour
#Switch off the network in every three hour
while [ 1 -lt 2 ]
do
networksetup -setairportpower en0 off;
sleep 3h;
done
#:)
@blpabhishek
blpabhishek / .zshrc
Created September 16, 2018 17:19
zshrc
export HOMEBREW_NO_GITHUB_API=1
export HOMEBREW_NO_ANALYTICS=1
export N_PREFIX=~/.n
# Handle Zsh history
export HISTFILE=~/.zsh_history
export HISTSIZE=10000000
export SAVEHIST=10000000
setopt BANG_HIST # Treat the '!' character specially during expansion.
@blpabhishek
blpabhishek / .envrc
Created December 3, 2018 12:10
.envrc for golang
export GOENV_VERSION=1.10.3
export GOPATH=$HOME/go
export PATH=$PATH:$GOPATH/bin
export PATH=/usr/local/opt/freetds@0.91/bin:$PATH
@blpabhishek
blpabhishek / download-sqs.py
Created December 5, 2018 08:29
This script downloads messages from AWS Queue to a folder
import argparse
import boto.sqs
import json
import os
parser = argparse.ArgumentParser(description='Saves all messages from an AWS SQS queue into a folder.')
parser.add_argument(
'-q', '--queue', dest='queue', type=str, required=True,
help='The name of the AWS SQS queue to save.')
@blpabhishek
blpabhishek / ssh_Proxy.sh
Created December 17, 2018 10:33
ssh Proxy
ssh -i ${KEY_FILE} -o ProxyCommand="ssh -i ${KEY_FILE} $2@bastion.$1.example.com nc %h %p" $2@$3 $4
@blpabhishek
blpabhishek / generate_pem
Created December 17, 2018 17:24
Generate private and public key pair
openssl genrsa -out private.pem 2048
openssl rsa -in private.pem -outform PEM -pubout -out public.pem
@blpabhishek
blpabhishek / hello.sh
Created December 21, 2019 04:46
ssh key encryption
ssh-keygen -m PEM -t rsa -b 4096
openssl rsa -in identity -pubout
echo content | openssl rsautl -encrypt -pubin -inkey identity.pub.pem > ciphertext.txt
openssl rsautl -decrypt -inkey identity -in ciphertext.txt