Skip to content

Instantly share code, notes, and snippets.

Ashish Kumar ashfame

Block or report user

Report or block ashfame

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
ashfame /
Created Nov 5, 2011
Shutdown linux (Ubuntu) when Dropbox completes transfer
# By Ashfame
while true
# keep checking for idle dropbox status
STATUS=`dropbox status`
if [ $STATUS = 'Idle' ]; then
notify-send "System Shutdown" "System will power off now"
ashfame / gist:1370753
Created Nov 16, 2011
Bash script to generate a html file describing all tables in a database
View gist:1370753
#Change your db username, password & database name
if [ -f ~/Desktop/db_schema.html ]; then
rm ~/Desktop/db_schema.html
for i in `mysql -B -N -uroot -proot dbname -e 'show tables;'`; do
echo "<a href='#$i'>$i</a><br />" >> /tmp/$$.nav.html
ashfame / delete-all-tags.php
Created Nov 25, 2011
Delete all tags of a WP install
View delete-all-tags.php
* Delete all tags of a WordPress blog
* @author Ashfame
* Place this file in root of your WordPress install and open it in the browser -
ashfame / index.php
Created Dec 12, 2011
SugarCRM REST API call examples
View index.php
* SugarCRM RESTS API Call examples
* REST API Wrapper -
<!doctype html>
<meta charset="utf-8">
ashfame / wpautop-control.php
Created Dec 31, 2011
Function to remove wpautop filter for specific post IDs
View wpautop-control.php
* Function to remove wpautop filter for specific post IDs
add_action( 'init', 'do_ma_thang' );
function do_ma_thang() {
global $wp_query;
$exclusion = array( 1, 5, 7 ); // add post IDs here
ashfame / example.php
Created Jan 24, 2012
Changing postmeta fields programmatically
View example.php
require 'wp-load.php';
$postmeta_field_name = 'video_url'; // fill it
echo $query = "SELECT * FROM {$wpdb->postmeta} WHERE meta_key = '$postmeta_field_name';";
$data = $wpdb->get_results( $query );
# Count no of files in repo
svn info -R --xml file:///path/to/rep | grep kind=\"file\"|wc -l
# SVN command to give commit authors list and save it in author-transform.txt
svn log -q | awk -F '|' '/^r/ {sub("^ ", "", $2); sub(" $", "", $2); print $2" = "$2" <"$2">"}' | sort -u > authors-transform.txt
ashfame / Best-way-to-wrap-up-your-jQuery-code-for-avoiding-conflicts.js
Created Feb 27, 2012
Best way to wrap up your jQuery code for avoiding conflicts
View Best-way-to-wrap-up-your-jQuery-code-for-avoiding-conflicts.js
// Regular jQuery code inside
View awesome-wp-config-file.php
* Define type of server
* Depending on the type other stuff can be configured
* Note: Define them all, don't skip one if other is already defined
define( 'DB_CREDENTIALS_PATH', dirname( ABSPATH ) ); // cache it for multiple use
ashfame / local-config-awesome-wp-config-file.php
Created Feb 27, 2012
Local config file to hold db credentials and for defining keys & salts along with the use of awesome wp-config.php file
View local-config-awesome-wp-config-file.php
* WordPress config file to use one directory above WordPress root, when awesome version of wp-config.php is in use.
* Awesome wp-config.php file -
/* WordPress Local Environment DB credentials */
You can’t perform that action at this time.