Skip to content

Instantly share code, notes, and snippets.

@faizal2007
faizal2007 / l2tp-elementary
Created March 12, 2020 15:31
Create l2tp elementary
## Install related library
sudo apt install git intltool libtool network-manager-dev libnm-util-dev libnm-glib-dev libnm-glib-vpn-dev libnm-gtk-dev libnm-dev libnma-dev ppp-dev libdbus-glib-1-dev libsecret-1-dev libgtk-3-dev libglib2.0-dev xl2tpd strongswan libnss3-dev libssl-dev
git clone https://github.com/nm-l2tp/network-manager-l2tp.git
cd network-manager-l2tp
autoreconf -fi
intltoolize
./configure \
--disable-static --prefix=/usr \
@faizal2007
faizal2007 / snapshot_restore
Last active March 1, 2020 07:31
Sample related script to manage xen with xen-tools
## Need to run manual paste command
### Create snapshot
lvcreate -L50G -s -n centos-disk-snapshot /dev/sanbox-vg/centos-disk-fresh
### Restore snapshot
lvconvert --merge /dev/sanbox-vg/centos-disk-snapshot
lvchange -an /dev/sanbox-vg/centos-disk-fresh
lvchange -ay /dev/sanbox-vg/centos-disk-fresh
@faizal2007
faizal2007 / zimbra-backup-emails.sh
Created August 9, 2017 03:58 — forked from filippo/zimbra-backup-emails.sh
How to backup and restore emails of a specific account on zimbra
# The command below creates a tgz file with all emails for [email protected] in .eml format:
# execute as root
/opt/zimbra/bin/zmmailbox -z -m [email protected] getRestURL "//?fmt=tgz" > /tmp/account.tgz
# You can do the same via a REST URL:
wget http://ZIMBRA.SERVER/home/[email protected]/?fmt=tgz
# to restore email:
/opt/zimbra/bin/zmmailbox -z -m [email protected] postRestURL "//?fmt=tgz&resolve=reset" /tmp/account.tgz
@faizal2007
faizal2007 / custom-options-5.2.17.sh
Created May 3, 2017 23:41
phpfarm compile option
#!/bin/bash
# You can override config options very easily.
# Just create a custom options file; it may be version specific:
# - custom-options.sh
# - custom-options-5.sh
# - custom-options-5.3.sh
# - custom-options-5.3.1.sh
#
# Don't touch this file here - it would prevent you to just "svn up"
# your phpfarm source code.
@faizal2007
faizal2007 / xen-conf
Last active October 24, 2023 03:32
Xen cfg file for creating centos using iso
# Sample centos xen config file
vcpus = '2'
memory = '2046'
#
# Disk device(s).
#
# Comment 'file:/home/freakie/CentOS-7-x86_64-Minimal-1611.iso,hdc:cdrom,r' after installation complete
disk = [
@faizal2007
faizal2007 / check_mysql_remote.sh
Created October 18, 2016 10:49
Check mysql remote port access
#!/bin/bash
SERVER=db2
PORT=3306
(echo > /dev/tcp/$SERVER/$PORT)
if [ "$?" -ne 0 ]; then
echo "Connection to $SERVER on port $PORT failed"
/etc/init.d/mysql stop
/etc/init.d/mysql bootstrap
exit 1
@faizal2007
faizal2007 / overrite-output.sh
Created April 21, 2016 04:19
Over rite output line by line
#!/bin/bash
c=5 # seconds to wait
REWRITE="\e[25D\e[1A\e[K"
echo "Starting..."
while [ $c -gt 0 ]; do
c=$((c-1))
sleep 1
echo -e "${REWRITE}Backup Bola..$c"
done
@faizal2007
faizal2007 / ssh-port-forward.sh
Last active September 4, 2015 17:21
SSH Remote Port Forwarding
#!/bin/bash
##
#
# @package Localhost Port Forwarder
# Allow access private server behind firewall
#
# @todo
# + Server config save
# + Multiple server port
# + Switch port forward type L - Local Port R - Remote Port
# phpMyAdmin default Apache configuration
Alias /dbadmin /var/www/dbadmin
<Directory /var/www/dbadmin>
Options FollowSymLinks
DirectoryIndex index.php
<IfModule mod_php5.c>
AddType application/x-httpd-php .php
@faizal2007
faizal2007 / macgen.pl
Created December 1, 2014 20:03
Create mac address
#!/usr/bin/perl -w
##
#
# Generate mac address
#
##
for ($i=0;$i<5;$i++){$m[$i]=int(rand(256));} printf "02:%X:%X:%X:%X:%X\n",@m;