Skip to content

Instantly share code, notes, and snippets.

View amgohan's full-sized avatar

Sidi Amine Bouhamidi amgohan

  • Ticketmaster
  • Quebec city
View GitHub Profile
cache_mem 0
cache deny all
max_filedescriptors 524288
acl SSL_ports port 443 444 563
acl netgiro_ports port 4312 5312
acl Safe_ports port 80 # http
acl Safe_ports port 443 # https
acl Safe_ports port 21 # ftp
acl ftp_access proto FTP
@amgohan
amgohan / squash
Created May 1, 2018 00:05
Squash the last 'n' commits
#!/bin/sh
# usage : squash 3 "new comment to replace the 3 last commits"
active_branch=$(git branch | head -n 1)
branch_name=${active_branch:2}
commits_to_squash=$1
new_commit_message=$2
git reset --soft HEAD~${commits_to_squash}
git commit -am "${new_commit_message}"
git push origin +${branch_name}
@amgohan
amgohan / mvnprofile
Created May 4, 2017 03:14
switch maven settings.xml by profile (home, work) for example
#!/bin/bash
set -e
PROFILE=$1
SETTINGS_FILE=~/.m2/settings.xml.${PROFILE}
if [ -a ${SETTINGS_FILE} ]
then
cp -f ~/.m2/settings.xml.${PROFILE} ~/.m2/settings.xml
echo "Profile [$1] activated [~/.m2/settings.xml]"
else
@amgohan
amgohan / gitclone.install
Last active April 28, 2017 05:25
add user and email automatically to cloned project
#!/bin/bash
echo "enter your git user.name"
read user_name
echo "enter your git user.email"
read user_email
cat > /bin/gitclone <<- EOM
#!/bin/bash
set -e
git clone \$1
@amgohan
amgohan / MongoConnectionManager.java
Last active August 29, 2017 20:40
Mongo Connection Manager using Morphia
import java.net.UnknownHostException;
import org.mongodb.morphia.Datastore;
import org.mongodb.morphia.Morphia;
import com.mongodb.MongoClient;
public class MongoConnectionManager {
private static final MongoConnectionManager INSTANCE = new MongoConnectionManager();