Skip to content

Instantly share code, notes, and snippets.

View davit's full-sized avatar

Davit davit

  • Web Intelligence
  • Tbilisi
View GitHub Profile
@davit
davit / install-drupal8.sh
Last active March 25, 2016 11:21
An interactive command line drupal 8 installer
#!/bin/bash
# Interactive drupal installation
### Allow only root users to use the script
if [ "$EUID" -ne 0 ]; then
echo "Script must be run as a root."
exit 1
fi
@davit
davit / create-drupal.sh
Last active August 29, 2015 14:21
Install Drupal and create virtual host for it - requires 'create-vhosts' script to be installed.
#!/bin/bash
accountName=$1
accountPass=$2
dbUserName=$3
dbPass=$4
dbName=$5
siteName="$6"
contextRoot=$7
drupalVer=$8
@davit
davit / create-vhosts.sh
Last active August 29, 2015 14:21
Creates a virtual host for a given domain
#!/bin/bash
domain=$1
serverRoot=$2
createRootFolder=$3
vhostPath=/etc/apache2/sites-available/
vhostFile=${domain}.conf
function print_usage {
@davit
davit / .gitignore
Created May 17, 2015 18:49
Drupal .gitignore file example
# Ignore configuration files that may contain sensitive information.
sites/*/*settings*.php
# Ignore paths that contain generated content.
files/
sites/*/files
sites/*/private
# Ignore default text files
robots.txt
$calendar = array(
9 => array(
0 => array(),
1 => array(),
2 => array(),
3 => array(
"start_date" => 9,
"end_date" => 12,
"event_name" => "Cool Event0"
),
<?php
$has_event_class = 'has-event-false';
$events = array(
0 => array(
'city' => 'Tbilisi',
'start_date' => '2014-11-18 09:00',
'end_date' => '2014-11-18 12:00',
'name' => 'Meeting with Jesus'
),
@davit
davit / cdrupal.sh
Last active August 29, 2015 14:07
Download and install drupal using drush (by no means should this be used in an unsafe environment)
#!/bin/bash
drupal_version=$1
site_name=$2
db_user=$3
db_pass=$4
db_name=$5
function print_usage() {
echo -e "Usage: $0 drupal_version site_name db_user db_pass db_name"
@davit
davit / dcommit.sh
Last active August 29, 2015 14:07
This script should be used together with "exportdb" script. FOR LOCAL USE ONLY!!!
#!/bin/bash
program_name=`basename $0`
function print_usage() {
echo -e "Usage: ${program_name} [-i module1 module2 ... ] [-e database_name] [-m \"git commit message\"]"
exit "$1"
}
function install_modules() {
@davit
davit / port by service
Last active January 1, 2016 18:09
A linux script for finding a port number according to a service (e.g. http: 80)
#!/bin/bash
# This one displays both service and port number colored in red (most likely):
egrep --color -o -m 1 '^'$1' *[0-9]+' /etc/services
# This one displays only the port number:
egrep -o -m 1 '^'$1'\s+[0-9]+' /etc/services | grep -P -o '\d+$'
@davit
davit / download-script
Last active June 30, 2024 03:40
A small bash script that downloads, extracts and removes the zip/gz file.
#!/bin/sh
if [[ $1 =~ \.zip$ ]]; then
wget $1 && sudo unzip *.zip && sudo rm *.zip
elif [[ $1 =~ \.gz$ ]]; then
wget $1 && sudo tar -zxvf *.gz && sudo rm *.gz
fi