Skip to content

Instantly share code, notes, and snippets.

@rotexdegba
rotexdegba / creating-new-sites-apache2.md
Last active Dec 8, 2019
How to enable new sites in apache2 on ubuntu 16.04 / Mint 18
View creating-new-sites-apache2.md

sudo cp /etc/apache2/sites-available/000-default.conf /etc/apache2/sites-available/mynewsite.conf

<VirtualHost *:80>
    ServerName rotimi.dev
	ServerAlias *.rotimi.dev
	ServerAdmin savedrotex@gmail.com
    DocumentRoot /var/www/html/promis-2.0/public

	ErrorLog /var/www/html/promis-2.0/logs/apache-error.log
@rotexdegba
rotexdegba / linux-rails-and-redmin-in-ubuntu-1604-mint18.sh
Last active Oct 14, 2020
Installing Rails and Redmine in Ubuntu 16.04 LTS / Linux Mint 18
View linux-rails-and-redmin-in-ubuntu-1604-mint18.sh
# Make sure you have already installed apache and mysql;
# see https://gist.github.com/rotexdegba/d0cab757b5194a58c93db5ab6df7dc67
# for instructions.
# install rails
# https://help.ubuntu.com/lts/serverguide/ruby-on-rails.html
sudo apt install rails
# install comman dependencies
sudo apt-get install build-essential patch ruby-dev zlib1g-dev liblzma-dev make libmysqlclient-dev imagemagick \
@rotexdegba
rotexdegba / linux-commands-for-setting-up-lamp-on-ubuntu-1604-mint18.sh
Last active Jun 8, 2018
Linux commands for setting up lamp on Ubuntu 16.04 and Mint 18
View linux-commands-for-setting-up-lamp-on-ubuntu-1604-mint18.sh
# More info:
# https://help.ubuntu.com/lts/serverguide/index.html
# http://do.co/2bwsv2X (Digital Ocean: How To Install LAMP stack on Ubuntu 16.04)
# fetch lists of updates
sudo apt-get update
######################
# ESSENTIAL UTILITIES
######################
@rotexdegba
rotexdegba / remove-old-linux-kernels.sh
Last active Sep 9, 2016
remove old linux kernels in a debian flavored linux distro like ubuntu, mint, etc.
View remove-old-linux-kernels.sh
dpkg -l 'linux-*' | sed '/^ii/!d;/'"$(uname -r | sed "s/\(.*\)-\([^0-9]\+\)/\1/")"'/d;s/^[^ ]* [^ ]* \([^ ]*\).*/\1/;/[0-9]/!d' | xargs sudo apt-get -y purge
@rotexdegba
rotexdegba / common-ubuntu-software-i-use.md
Last active Sep 28, 2017
A list of applications I normally use on my Ubuntu or Mint Desktop Machines.
View common-ubuntu-software-i-use.md
@rotexdegba
rotexdegba / where-or-having-params-extractor.php
Last active Apr 28, 2016
where or having params extractor
View where-or-having-params-extractor.php
<?php
$array = [
'where' =>
[
[ 'col'=>'column_name_1', 'operator'=>'>', 'val'=>58 ],
[ 'col'=>'column_name_2', 'operator'=>'>', 'val'=>58 ],
'OR'=> [
[ 'col'=>'column_name_1', 'operator'=>'<', 'val'=>58 ],
[ 'col'=>'column_name_2', 'operator'=>'is-null' ]
@rotexdegba
rotexdegba / mem-consumption-tests.php
Created May 26, 2015
PHP Script to Benchmark Memory Consumtion on Common Array / Object / String Memory Consumption
View mem-consumption-tests.php
<?php
ini_set('memory_limit', '1024M');
function test(){
$index = 0;
//Case 1
$a = '';
@rotexdegba
rotexdegba / download-full-copy-of-website-via-wget.sh
Last active Aug 14, 2019
How to download a full copy of a website for offline reading via wget
View download-full-copy-of-website-via-wget.sh
wget --wait=20 --mirror --convert-links --page-requisites --no-parent -U Mozilla http://www.website.com/
# OR
wget --wait=20 --mirror --convert-links --adjust-extension --page-requisites --no-parent -U Mozilla http://www.website.com/
@rotexdegba
rotexdegba / quickly-convert-xml-to-php-objects.php
Created Apr 9, 2015
How to Quickly Convert Xml Read into a SimpleXMLElement object into PHP Objects
View quickly-convert-xml-to-php-objects.php
<?php
$url = 'http://some-server.com/some-file.xml';
$simplexmlelement_obj = simplexml_load_file($url);
$array_of_objects_from_xml = array();
if ($simplexmlelement_obj !== false) {
$xml_as_json = json_encode($simplexmlelement_obj);
$array_of_objects_from_xml = json_decode($xml_as_json);
You can’t perform that action at this time.