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 / gist:bb7e61ed054ac7b53c1fde8c1d1d7c36
Created July 19, 2018 12:15 — forked from adamstac/gist:7462202
Install and configure Sendmail on Ubuntu

Install and configure Sendmail on Ubuntu

This should help you get Sendmail installed with basic configuration on Ubuntu.

  1. If sendmail isn't installed, install it: sudo apt-get install sendmail
  2. Configure /etc/hosts file: nano /etc/hosts
  3. Make sure the line looks like this: 127.0.0.1 localhost yourhostname
  4. Run Sendmail's config and answer 'Y' to everything: sudo sendmailconfig
  5. Restart apache sudo service apache2 restart
@jmcabandara
jmcabandara / FizzBuzz.py
Created July 23, 2018 07:12 — forked from jaysonrowe/FizzBuzz.py
FizzBuzz Python Solution
def fizzbuzz(n):
if n % 3 == 0 and n % 5 == 0:
return 'FizzBuzz'
elif n % 3 == 0:
return 'Fizz'
elif n % 5 == 0:
return 'Buzz'
else:
return str(n)

Fizz Buzz Test

Write a program that prints the numbers from 1 to 100. But for multiples of three print “Fizz” instead of the number and for the multiples of five print “Buzz”. For numbers which are multiples of both three and five print “FizzBuzz”.

Answer & Refinement process

Don't look until you want to see how I thought through it:

Final Shortest Answer

@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`; }
@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 / 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 / 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 / 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 / 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 / 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