Skip to content

Instantly share code, notes, and snippets.

View jmcabandara's full-sized avatar
🎯
Focusing

Chaminda Bandara jmcabandara

🎯
Focusing
View GitHub Profile
@jmcabandara
jmcabandara / scp run in the background
Created January 14, 2019 14:31 — forked from CreatorB/scp run in the background
How to put scp in background
To execute any linux command in background we use nohup. But the problem with scp command is that it prompts for the password (if password authentication is used). So to make scp execute as a background process do this:
1>
$ nohup scp file_to_copy user@server:/path/to/copy/the/file > nohup.out 2>&1
if it prompts for password then enter password.
Then press ctrl + z which will temporarily suspend the command,
SCP will give output:
@jmcabandara
jmcabandara / install-latest-ruby-on-centos-7.sh
Created January 14, 2019 08:18
ruby latest setup for centos 7.x
#!/usr/bin/env bash
set -ex
toolset=devtoolset-7
yum install -y epel-release # EPEL repo
yum install -y centos-release-scl # shiny-new(er) compliers
# make sure there are no surprises installing from repos
grep -r gpgkey= /etc/yum.repos.d/ | cut -d= -f2 | xargs -L1 rpm --import
yum update -y # system update
# misc dev tools, but we're not going to use the ancient toolchain
@jmcabandara
jmcabandara / etc-hosts-on-win.md
Created November 14, 2018 07:22 — forked from zenorocha/etc-hosts-on-win.md
/etc/hosts on Windows

1. Get your IP Address

echo `ifconfig $(netstat -nr | grep -e default -e "^0\.0\.0\.0" | head -1 | awk '{print $NF}') | grep -e "inet " | sed -e 's/.*inet //' -e 's/ .*//' -e 's/.*\://'`

2. Modify your hosts file

notepad

@jmcabandara
jmcabandara / installation.md
Created October 31, 2018 15:21 — forked from neuralsandwich/installation.md
GitLab installation on CentOS 6

Overview

The GitLab installation consists of setting up the following components:

  1. Packages / Dependencies
  2. Ruby
  3. System Users
  4. GitLab shell
  5. Database
  6. GitLab
@jmcabandara
jmcabandara / install_jenkins.sh
Created September 13, 2018 16:47 — forked from William-Hill/install_jenkins.sh
Install Jenkins on CentOS 6
sudo wget -O /etc/yum.repos.d/jenkins.repo http://pkg.jenkins-ci.org/redhat/jenkins.repo
sudo rpm --import https://jenkins-ci.org/redhat/jenkins-ci.org.key
sudo yum install jenkins
@jmcabandara
jmcabandara / Perm-Missing-Elem.js
Created September 2, 2018 15:26 — forked from unlight/Perm-Missing-Elem.js
Perm-Missing-Elem
/*
A zero-indexed array A consisting of N different integers is given. The array contains integers in the range [1..(N + 1)], which means that exactly one element is missing.
Your goal is to find that missing element.
Write a function:
int solution(int A[], int N);
that, given a zero-indexed array A, returns the value of the missing element.
@jmcabandara
jmcabandara / InstallJBossonCentOS7.md
Created August 14, 2018 10:59 — forked from Burning-Chai/InstallJBossonCentOS7.md
How to install JBOSS on CentOS7
$ sudo rpm -ihv jdk-8u91-linux-x64.rpm
$ java -version
java version "1.8.0_91"
Java(TM) SE Runtime Environment (build 1.8.0_91-b14)
Java HotSpot(TM) 64-Bit Server VM (build 25.91-b14, mixed mode)

$ javac -version
javac 1.8.0_91
@jmcabandara
jmcabandara / sampleREADME.md
Created August 13, 2018 15:47 — forked from FrancesCoronel/sampleREADME.md
A sample README for all your GitHub projects.

FVCproductions

INSERT GRAPHIC HERE (include hyperlink in image)

Repository Title Goes Here

Subtitle or Short Description Goes Here

@jmcabandara
jmcabandara / parse-options.sh
Created August 3, 2018 08:05 — forked from cosimo/parse-options.sh
Example of how to parse options with bash/getopt
#!/bin/bash
#
# Example of how to parse short/long options with 'getopt'
#
OPTS=`getopt -o vhns: --long verbose,dry-run,help,stack-size: -n 'parse-options' -- "$@"`
if [ $? != 0 ] ; then echo "Failed parsing options." >&2 ; exit 1 ; fi
echo "$OPTS"
@jmcabandara
jmcabandara / example.sh
Created August 3, 2018 08:05 — forked from shakefu/example.sh
Bash Script with Short and Long Options
# Option defaults
OPT="value"
# getopts string
# This string needs to be updated with the single character options (e.g. -f)
opts="fvo:"
# Gets the command name without path
cmd(){ echo `basename $0`; }