Skip to content

Instantly share code, notes, and snippets.

View jibone's full-sized avatar
🧑‍💻
building mode.

J Shamsul Bahri jibone

🧑‍💻
building mode.
View GitHub Profile
@jibone
jibone / .vimrc
Created March 5, 2012 03:29
My .vimrc file...
set tabstop=4
set softtabstop=4
set shiftwidth=4
" textmate like set invisibles.
" ctrl-v u25b8 for ▸ and ctrl-v u00ac for ¬
set listchars=tab:▸\ ,eol:¬
set list
set nohls
@jibone
jibone / VBoxHeadless VBoxManage
Created March 5, 2012 11:21
Create, modify, start and stop a VBoxHeadless
# Create a VBox VM #
====================
VBoxManage createvm --name "Ubuntu 10.10 Server" --register
VBoxManage modifyvm "Ubuntu 10.10 Server" --memory 256 --acpi on --boot1 dvd --nic1 bridged --bridgeadapter1 eth0
VBoxManage createhd --filename Ubuntu_10_10_Server.vdi --size 10000
VBoxManage storagectl "Ubuntu 10.10 Server" --name "IDE Controller" --add ide
VBoxManage storageattach "Ubuntu 10.10 Server" --storagectl "IDE Controller" --port 0 --device 0 --type hdd --medium Ubuntu_10_10_Server.vdi
VBoxManage storageattach "Ubuntu 10.10 Server" --storagectl "IDE Controller" --port 1 --device 0 --type dvddrive --medium /home/ubuntu-10.10-server-amd64.iso
@jibone
jibone / 1) create sample init script
Created March 13, 2012 09:49
Creating a Debian init script
#! /bin/sh
# /etc/init.d/blah
#
# Some things that run always
touch /var/lock/blah
# Carry out specific functions when asked to by the system
case "$1" in
start)
@jibone
jibone / .vimrc
Created April 23, 2012 14:58
My .vimrc for gvim on windows.
set number
colorscheme desert
set tabstop=4
set softtabstop=4
set shiftwidth=4
set listchars=tab:>\ ,eol:¬
@jibone
jibone / .gitignore
Created September 4, 2012 05:39
My typical .gitignore file
# Compiled source #
###################
*.com
*.class
*.dll
*.exe
*.o
*.so
# Packages #
@jibone
jibone / .htaccess
Created October 5, 2012 04:14
My typical .htaccess file
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^css/(.*) public/css/$1 [L]
RewriteRule ^js/(.*) public/js/$1 [L]
RewriteRule ^img/(.*) public/img/$1 [L]
RewriteRule ^font/(.*) public/font/$1 [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)$ bootstrap.php [QSA,L]
</IfModule>
@jibone
jibone / gist:3915933
Created October 19, 2012 02:32
Login to EC2 with .pem
ssh -l USERNAME_HERE -i .ssh/yourkey.pem public-ec2-host
@jibone
jibone / functions.php
Created October 29, 2012 10:00
Get first paragraph from post.
if(!function_exists('get_the_content_first_paragraph')) :
function get_the_content_first_paragraph() {
$content = get_the_content();
$content = apply_filters('the_content', $content);
$content = str_replace(']]>', ']]&gt;', $content);
$content_explode = explode("</p>", $content);
$c = 0; $p = count($content_explode); $return_data = "";
while($c < $p) {
$test = strip_tags($content_explode[$c]);
@jibone
jibone / Find and repace
Created December 22, 2012 16:28
Just the mysql statement for find and replace.
UPDATE wp_posts set post_body = replace(post_body, 'needle', 'chocolate');
@jibone
jibone / daytime.php
Created January 2, 2013 04:29
count the number of days form today's date
<?php
$now = time() + 26888; // or your date as well
//$now2 = $now + 26888;
$your_date = strtotime("2013-01-14");
$datediff = $your_date - $now;
echo ceil($datediff/(60*60*24));
?>