Skip to content

Instantly share code, notes, and snippets.

Avatar

Johnathan Mark Smith JohnathanMarkSmith

View GitHub Profile
@JohnathanMarkSmith
JohnathanMarkSmith / How to concat string in mysql
Last active Dec 17, 2015
How to concat a string in mysql
View How to concat string in mysql
update table set field = concat(field,".value") where key_id != 0;
@JohnathanMarkSmith
JohnathanMarkSmith / LoadMySQL
Created May 6, 2013
How to load MySQL Database from Command Line in Linux
View LoadMySQL
I been getting asked, How can I load my MySQL database from the command line?
So I am going to make this quick and easy…
First cd in the folder where your sql file is, for this demo I am using a file called “backup.mysql”. Then use the following command
mysql --user root --password regandb < backup.mysql
MySQL will prompt you for a password then your mysql will be loaded depending on how big your backup/file is it may take some time. You could add a -f flag if your database is very big, it will prevent it from stopping if there is error.
@JohnathanMarkSmith
JohnathanMarkSmith / ApacheInstall.txt
Last active Dec 16, 2015
How to install Apache2 and PHP on Fedora, CentOS, Red Hat and Scientific Linux
View ApacheInstall.txt
How to install Apache2 and PHP on Fedora, CentOS, Red Hat and Scientific Linux
If you are using Fedora, CentOS, Red Hat or Scientific Linux I am going to show you the basic install of Apache2 and PHP using yum.
Install Apache2.
To install Apache2 just enter the following command:
yum install httpd
@JohnathanMarkSmith
JohnathanMarkSmith / MavenInstall.txt
Last active Jul 19, 2021
How to install Maven on Fedora, CentOS, Red Hat and Scientific Linux
View MavenInstall.txt
How to install Maven on Fedora, CentOS, Red Hat and Scientific Linux
If you are using Fedora, CentOS, Red Hat or Scientific Linux sometimes yum does not have the package for the product you would like to install and Maven is one of them at the time of me writing this blog.
I am going to show you how I install Maven on Fedora, CentOS, Red Hat or Scientific Linux you can do it the same way or find a better way.
Download Maven and untar it.
The first thing we need to do is to download the Maven tar file and untar it to a shared location on the workstation
wget http://mirrors.gigenet.com/apache/maven/maven-3/3.0.5/binaries/apache-maven-3.0.5-bin.tar.gz
View hello.sql
SELECT 'Hello, MySQL World!' AS Message
@JohnathanMarkSmith
JohnathanMarkSmith / OpenJDKInstall.txt
Last active Dec 16, 2015
How to install Java Open JDK 1.7 on Fedora, CentOS, Red Hat and Scientific Linux
View OpenJDKInstall.txt
How to install Java Open JDK 1.7 on Fedora, CentOS, Red Hat and Scientific Linux
I had some coworkers asking the same question time and time again “How Do I Install Java Open JDK 1.7?”.
So to make it easy once again here is my post and the details on how to do it.
su -c "yum install java-1.7.0-openjdk*"
Thats all you have to do… stop asking… :)
@JohnathanMarkSmith
JohnathanMarkSmith / CloneLocalGit.txt
Last active Dec 16, 2015
How to clone a local Git Repository
View CloneLocalGit.txt
oHow to clone a local Git Repository
I get asked a good number of times “How do I clone a local Git Repository?”. So do make it easy I am going to pust it on my blog site so I can just follow the link to in. are you ready??
This worked for me:
git clone file:////<host>/<share>/<path>
For example, if your main machine has the IP 192.168.10.51 and the computer name main, and it has a share named code which itself is a git repository, the both of the following commands should work equally:
View MirroringaGitrepostory.txt
Mirroring a Git repostory
The firm I recently stated working at just moved to Git and I am the only resource then knows Git. I get asked so many times a day on how to mirror a git repostory.
From the birds eyes very its very easy:
git clone --mirror git@git.com:project project
cd project
git remote add github git@github.com:username/project.git
@JohnathanMarkSmith
JohnathanMarkSmith / NumberOfCommitsByDeveloper.txt
Last active Dec 16, 2015
How to see the number of commits your developers made in your Git repository
View NumberOfCommitsByDeveloper.txt
How to see the number of commits your developers made in your Git repository
It looks like everyone is starting to use Git for version control and I get asked from managers “How can I check who is commiting work and doing all the work?”
The best way to see who is commiting work to your Git repository is easy. Just go into one of your Git repositories and type the following:
git shortlog -s -n -e --all
and your output should look like:
@JohnathanMarkSmith
JohnathanMarkSmith / LastTimeDeveloperDidCommit.txt
Last active Dec 16, 2015
How to see the last time a developer commited work and also the number of commits your developer made in your Git repository
View LastTimeDeveloperDidCommit.txt
How to see the last time a developer commited work and also the number of commits your developer made in your Git repository
How would you like to check-up on your developers and see that last time your developers commited work to your Git repository. I do this all the time to check on the developers on my projects.
The best way to see who is commiting work to your Git repository and the last time is easy. Just go into one of your Git repositories and type the following:
git shortlog -sne |awk '{print $1,$2,$3,system("git log -n1 --format=%cd --author=" $2)}'
and your output should look like: