Skip to content

Instantly share code, notes, and snippets.

View haisum's full-sized avatar

Haisum Mussawir haisum

View GitHub Profile
@haisum
haisum / script.sh
Created September 1, 2015 06:10
comment and uncomment lines in bash script via sed
sed -i '/<pattern>/s/^/#/g' file #comment
sed -i '/<pattern>/s/^#//g' file #uncomment
@haisum
haisum / postfix-dovecot-ubuntu14.04.sh
Last active February 7, 2024 08:37
Automated bash script to setup dovecot postfix mysql email server on ubuntu 14.04
#!/usr/bin/env bash
#####
# Script to install postfix
#####
DOMAIN="example.com"
EMAIL="haisum@example.com"
PASSWORD="example.com1*"
@haisum
haisum / releases.sh
Created November 2, 2016 22:46
Create and upload github releases
go get github.com/aktau/github-release
echo "export GITHUB_TOKEN=$1" >> ~/.bash_profile;
git tag v0.0
git push --tags
github-release.exe -v release --repo focusedu --user haisum -t v0.0 -d "Static file server"
github-release.exe -v upload --repo focusedu --user haisum -t v0.0 -n focusedu.exe -f focusedu.exe
@haisum
haisum / days_months_years.php
Created March 5, 2015 08:08
Loop through years, months and days in php for dropdown
<?php //All months
for($i=1;$i<=12;$i++) {?>
<option value="<?=$i?>"><?=date("F", strtotime("2001-" . $i . "-25"))?></option>
<?php } ?>
<?php
//past 8 years
for($i=0;$i<8;$i++) {?>
@haisum
haisum / install-varnish.sh
Created March 10, 2015 07:39
Varnish Installation on Cpanel or Whm
#!/bin/bash
# This script installs VARNISH Cache along side Apache on cPanel servers.
#This script installs VARNISH, changes the Apache port to 82, writes
# some config files, starts VARNISH, and terminates.
### Made by Shubham Mathur (itseasy21)
#-Colors :D
RED='\033[01;31m'
@haisum
haisum / C.sublime-build
Created November 16, 2015 06:26
C build system for sublime text 3 on windows
{
"cmd" : ["gcc", "$file_name", "-o", "${file_base_name}.exe"],
"selector" : "source.c",
"shell": true,
"working_dir" : "$file_path",
"variants" : [
{ "name": "Run",
"cmd" : ["${file_base_name}.exe"]
}
@haisum
haisum / docker_dedicated_filesystem.md
Created July 20, 2020 15:30 — forked from hopeseekr/docker_dedicated_filesystem.md
Putting Docker on its own pseudo filesystem

Docker on BTRFS is very buggy and can result in a fully-unusable system, in that it will completely butcher the underlying BTRFS filesystem in such a way that it uses far more disk space than it needs and can get into a state where it cannot even delete any image, requiring one to take drastic actions up to and including reformatting the entire affected BTRFS root file system.

According to the official Docker documentation:

btrfs requires a dedicated block storage device such as a physical disk. This block device must be formatted for Btrfs and mounted into /var/lib/docker/.

In my experience, you will still run into issues even if you use a dedicated partition. No, it seems it requires a standalone

@haisum
haisum / Html.class.php
Created July 23, 2019 20:35
Modified Non Yii Html class
<?php
/**
* Html class file.
*
* @author Qiang Xue <qiang.xue@gmail.com>
* @link http://www.yiiframework.com/
* @copyright 2008-2013 Yii Software LLC
* @license http://www.yiiframework.com/license/
*/
@haisum
haisum / dropuser.sql
Created October 10, 2016 08:26
Dropping connected users in oracle
select 'alter system kill session ''' || sid || ',' || serial# || ''';' from v$session where username = 'SCHEMANAME'
alter system kill session '1977,12013';
drop user 'SCHEMANAME';
@haisum
haisum / UploadedFile.class.php
Created July 23, 2019 20:42
PHP verify uploaded file class
<?php
/**
* CUploadedFile class file.
*
* @author Qiang Xue <qiang.xue@gmail.com>
* @link http://www.yiiframework.com/
* @copyright 2008-2013 Yii Software LLC
* @license http://www.yiiframework.com/license/
*/