This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
* To change this template, choose Tools | Templates | |
* and open the template in the editor. | |
*/ | |
/** | |
* | |
* @author napsternxg | |
*/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function returnFirstPostImage($id){ | |
global $wpdb; | |
$the_content =$wpdb->get_var("SELECT post_content FROM $wpdb->posts WHERE ID = $id"); | |
$pattern = '!<img.*?src="(.*?)"!'; | |
preg_match_all($pattern, $the_content, $matches); | |
$image_src = $matches['1'][0]; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
find ./ -name \*.[ch] -print -o -name \*.pm -print |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
find ./ -type f | grep -E ".*\.[a-zA-Z0-9]*$" | sed -e 's/.*\(\.[a-zA-Z0-9]*\)$/\1/' | sort | uniq -c | sort -n | tee filetype1.list |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
""" | |
The original code for the following program was written by Sangam Kumar Jain and can be found in the file test.py in this git project | |
You can connect with him at: http://www.facebook.com/jain.sangam | |
The code was written as a part of solving Project Euler Problem 3 (http://projecteuler.net/problem=3) which deals with finding the largest prime factor of a large number. | |
Currently the code finds all the powers of all prime factors of any large number. | |
I have rewritten a more modular and optimized version of the above code and tried to make it more easily comprehendable. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
echo -e "\e[32m"; while :; do printf '%*c' $(($RANDOM % 5)) $(($RANDOM % 7)); done |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
str = "This is a beautiful world" | |
" ".join(reversed(str.split(" "))) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
cat sample | sort -f | uniq -ci | sort -n | sed -e 's/\([0-9]\{1,\}\)[ ]*\(.*\)/\2: \1/g' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# syncFiles is a file name you can also use any command like ls, p4 sync ... instead of cat syncFiles | |
cat syncFiles | cut -f 2 -d "-" | sed -e 's/\([A-Za-z0-9 ]*\)\([\/\.A-Za-z0-9_]*\)\([A-Za-z0-9 ]*\)/\2/g' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//collect data containing sitename, total(questions, answers, comments, tags) on the page: http://data.stackexchange.com/ | |
data = []; | |
$(".site-list > li").each(function(){ | |
obj = {}; | |
obj.name = $(this).find("img").attr("alt"); | |
obj.totalQ = $(this).find(".totalQuestions > .pretty-short").attr("title"); | |
obj.totalA = $(this).find(".totalAnswers > .pretty-short").attr("title"); | |
obj.totalC = $(this).find(".totalComments > .pretty-short").attr("title"); |
OlderNewer