Skip to content

Instantly share code, notes, and snippets.

@RajatNair
RajatNair / p4merge-git-tool.md
Last active May 30, 2018 12:08 — forked from dgoguerra/p4merge-git-tool.md
Setup p4merge as difftool and mergetool on Windows

Setting up p4merge as diff and merge tool on Windows. Tried for Git version 1.8.4.msysgit.0.

Two alternatives are explained: using the command line, and directly editing the config file.

Setting up from the command line

Being the installation path "C:Program Files\Perforce\p4merge.exe", just run:

$ git config --global diff.tool p4merge
@RajatNair
RajatNair / post-receive
Created May 30, 2018 12:15 — forked from lemiorhan/post-receive
Post-receive hook to deploy the code being pushed to production branch to a specific folder
#!/bin/bash
target_branch="production"
working_tree="PATH_TO_DEPLOY"
while read oldrev newrev refname
do
branch=$(git rev-parse --symbolic --abbrev-ref $refname)
if [ -n "$branch" ] && [ "$target_branch" == "$branch" ]; then
@RajatNair
RajatNair / Get external IP, write to file
Last active October 20, 2018 20:41 — forked from scottlee/Get external IP, write to file
Get external IP address and write to file if it has changed
#!/bin/bash
# Where should this file be stored?
ipfile=~/Desktop/external-ip.txt
# Go ahead now, go ahead and get that IP
IP=$(curl -s https://icanhazip.com)
# Has the address changed? If it has go ahead and write that bad boy down. If not, no worries.
OLDIP=""
@RajatNair
RajatNair / Secure.your.Server.md
Last active December 9, 2018 17:43
Security tips to locking down your box

Security tips to locking down your box

1. SSH to your VPS (virtual private server)
2. Change root password from default
passwd root
3. Update VPS
sudo apt-get update && sudo apt-get upgrade && sudo apt-get dist-upgrade
@RajatNair
RajatNair / backup_strategy.md
Created January 2, 2019 12:27 — forked from gryte/backup_strategy.md
install_pms_centos_7

on plexserver, create directories

create scripts directory

sudo mkdir /scripts

create backup directory

@RajatNair
RajatNair / backup_to_nas.sh
Created January 2, 2019 12:29 — forked from rollcabbage/backup_to_nas.sh
files or log files backup script; backup object and destination be defined by associative array
#!/bin/bash
#
# created by RiHaku on June 2015
#
# mount -t nfs -o rw,rsize=8192,wsize=8192,hard,intr,noatime,bg,nfsvers=3 10.51.0.91:/DMZ /mnt/data
# mount -t nfs -o rw,rsize=8192,wsize=8192,hard,intr,noatime,bg,nfsvers=3 10.51.0.91:/TRUST /mnt/data
#
# mount check; if not mounted, exit with status code
df -h | awk 'NR == 5 {print $1}' | grep 10.51.0.91 >/dev/null 2>&1
#!/bin/bash
#
# This script will periodically check NFS mounts are up or not. If its not up
# it will mount them for you.
# Example - My Pi Zero will not mount my NFS drives at boot. This script
# will make sure that the drive is mounted.
#
#
# to run: docker-compose run
#
# Create a .evn file in the same folder as this file and change the variables.
# MOUNT_POINT=/tmp/
# VPN_PROVIDER=changeme
# VPN_CONFIG=changeme
# VPN_USERNAME=changeme
# VPN_PASSWORD=changeme
#
#
@RajatNair
RajatNair / network-detection-script.sh
Last active March 25, 2020 10:27
Odroid C2/N2, Raspberry Pi Zero - Network detection script
#!/bin/bash
# Author: Rajat Nair (aunlead.com)
# Description: This script will periodically check -
# - if device is on LAN
# - if remote share is online
# - Automount remote shares
# - Verify if DNS resolution is working
# - Verify if internet connectivity is working
# - Verify if server can be pinged
@RajatNair
RajatNair / index.html
Last active May 4, 2020 18:46
Request Queuing using Vanilla JavaScript and Typescript - https://stackblitz.com/edit/typescript-cdyebd
<h3>Request Queueing using Vanilla Javascript and Typescript</h3>
<div id="app"></div>
<div>
<h4>Console</h4>
<ol id="console">
</ol>
</div>