Skip to content

Instantly share code, notes, and snippets.

View sicksand's full-sized avatar

Shafiq Mustapa sicksand

View GitHub Profile
@sicksand
sicksand / restartdaily.sh
Created April 16, 2013 02:57
Place this bash script on your cron daily (yourapp/.openshift/cron/daily/restartdaily.sh) for a daily restart of your OpenShift's app
#!/bin/bash
set -e
ctl_all stop
sleep 2
ctl_all start
@sicksand
sicksand / dup.sh
Created June 20, 2013 02:08
how to clone/duplicate mysql database. using mysqldump one liner
mysqldump -u <user> --password=<password> <DATABASE_NAME> | mysql -u <user> --password=<password> -h <hostname> <DATABASE_NAME_NEW>
@sicksand
sicksand / virtual host apache
Created June 28, 2013 02:11
adding virtualhost to apache2
I added the following file, foo, to /etc/apache2/sites-available/:
<VirtualHost *:80>
ServerName foo
DocumentRoot /var/www/foo/foo
# Other directives here
<Directory />
Options FollowSymLinks
AllowOverride None
@sicksand
sicksand / chart.php
Last active January 3, 2016 13:09
Create Google Chart with custom data. Only 2 legends support for right now.
<html>
<head>
<script type="text/javascript" src="http://canvg.googlecode.com/svn/trunk/rgbcolor.js"></script>
<script type="text/javascript" src="http://canvg.googlecode.com/svn/trunk/canvg.js"></script>
<script>
function getImgData(chartContainer) {
var chartArea = chartContainer.getElementsByTagName('svg')[0].parentNode;
var svg = chartArea.innerHTML;
var doc = chartContainer.ownerDocument;
var canvas = doc.createElement('canvas');
<?php
/* Display the first image of wordpress post.
Put these function on file : functions.php
usage <?php echo _get_first_image(); ?>
*/
function _get_first_image(){
global $post, $posts;
$first_img = '';
ob_start();
ob_end_clean();
@sicksand
sicksand / convertimage.txt
Last active August 29, 2015 14:01
convertimage.txt
#use imagemagick to convert/resize image on the fly
convert ../Downloads/picjumbo.com_IMG_0993.jpg -resize 720x1280^ -gravity Center -crop 720x1280+0+0 +repage food_bg_1_720x1280.jpg
@sicksand
sicksand / androidscreensize.txt
Created May 11, 2014 09:21
Android Screen Size
LDPI- icon-32x32, splash-426x320
MDPI- icon-48x48, splash-470x320
HDPI- icon 72x72, splash- 640x480
XHDPI- icon-96x96, splash- 960x720
XXHDPI- icon- 144x144
@sicksand
sicksand / templated.php
Last active May 10, 2021 05:39
Stumble this upon site ( http://templated.co ) that offer over 800+ HTML5 + CSS + Responsive. This php script will download the file automatically. For now, the page is now 20.
<?php
/*
Name - templated.php
Author - Shafiq Mustapa (me@shafiqmustapa.my)
Usage - php templated.php
Stumble this upon site (http://templated.co)that offer over 800+ HTML5 + CSS + Responsive.
This php script will download the file automatically. For now, the page is now 7.
Tools
@sicksand
sicksand / mysql_result.php
Created April 1, 2015 04:47
Use this function if you have legacy PHP script < 5.5 that use (mysql_result) to get result from mysql.
<?php
/*
* mysql_result.php
*
* @author Shafiq Mustapa<me@shafiqmustapa.my>
* @created 1st April 2015
* @version 1.0
* @desc Use this function if you have legacy PHP script < 5.5 that use (mysql_result) to get result from mysql.
*/
@sicksand
sicksand / install_laravel_5_with_LAMP_stack.md
Last active August 29, 2015 14:27
Install Laravel 5 with LAMP stack