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
ashfame / shutdown-dropbox-done.sh
Created Nov 5, 2011
Shutdown linux (Ubuntu) when Dropbox completes transfer
View shutdown-dropbox-done.sh
#!/bin/bash
# By Ashfame
while true
do
# keep checking for idle dropbox status
STATUS=`dropbox status`
if [ $STATUS = 'Idle' ]; then
notify-send "System Shutdown" "System will power off now"
@ashfame
ashfame / gist:1370753
Created Nov 16, 2011
Bash script to generate a html file describing all tables in a database
View gist:1370753
#!/bin/bash
#Change your db username, password & database name
if [ -f ~/Desktop/db_schema.html ]; then
rm ~/Desktop/db_schema.html
fi
for i in `mysql -B -N -uroot -proot dbname -e 'show tables;'`; do
echo "<a href='#$i'>$i</a><br />" >> /tmp/$$.nav.html
@ashfame
ashfame / delete-all-tags.php
Created Nov 25, 2011
Delete all tags of a WP install
View delete-all-tags.php
<?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 - domain.com/delete-all-tags.php
*/
@ashfame
ashfame / index.php
Created Dec 12, 2011
SugarCRM REST API call examples
View index.php
<?php
/**
* SugarCRM RESTS API Call examples
*
* REST API Wrapper - https://github.com/asakusuma/SugarCRM-REST-API-Wrapper-Class
*/
?>
<!doctype html>
<head>
<meta charset="utf-8">
@ashfame
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
ashfame / example.php
Created Jan 24, 2012
Changing postmeta fields programmatically
View example.php
<pre><?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 );
View svn-commands.sh
# 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
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
(function($){
// Regular jQuery code inside
$(document).ready(function(){
});
})(jQuery);
View awesome-wp-config-file.php
<?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
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
<?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 - https://gist.github.com/1923821
*/
/* WordPress Local Environment DB credentials */
You can’t perform that action at this time.