Skip to content

Instantly share code, notes, and snippets.

@fdb713
fdb713 / gist:5185754
Created March 18, 2013 08:30
date and time sync on centos
#!/bin/bash
yum install -y ntp
ntpdate 0.centos.pool.ntp.org
sleep 3
hwclock --systohc
@fdb713
fdb713 / gist:4673119
Last active December 11, 2015 22:58
min stored procedure of pagination
-- --------------------------------------------------------------------------------
-- Routine DDL
-- Note: comments before and after the routine body will not be stored by the server
-- --------------------------------------------------------------------------------
DELIMITER $$
CREATE DEFINER=`root`@`localhost` PROCEDURE `paginate`(
in _table varchar(100),
in _where varchar(100),
in _order_by varchar(100),
@fdb713
fdb713 / gist:4611033
Created January 23, 2013 17:56
codeigniter check username when logging in using ajax
<?php
function ajax_lookUpUsername(){
$username = $this->input->post('username');
$this->db->where('username', $username);
$query = $this->db->get('accounts');
if ($query->num_rows() > 0){
echo 0;
} else {
echo 1;
}