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
/** | |
* @author Prahlad Yeri | |
* @copyright MIT license | |
* @brief Custom javascript library for doing misc things. | |
* @date 28-01-2015 | |
*/ | |
/** | |
* @brief Constructor pattern for menu item. | |
* @param text Text to display on menu. "-" for divider. |
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
#!/usr/bin/python | |
# author: Prahlad Yeri | |
# description: Script to track bandwidth consumption and put in database. Place this in /etc/NetworkManager/dispatcher.d/ | |
import subprocess, os, datetime, sys | |
def execute(command): | |
try: | |
p=subprocess.Popen(command, shell=True,stdout=subprocess.PIPE,stderr=subprocess.PIPE) | |
p.wait() |
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
import java.util.ArrayList; | |
import java.util.List; | |
import java.util.function.Predicate; | |
interface ProductFilter | |
{ | |
public boolean run(Product p); | |
} | |
public class Product |
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
<?php | |
//Fetching the latest value of BSE-Sensex in just 9 lines of PHP code: | |
$data = http_build_query(array("client"=>"ig", "q" => 'BSE:SENSEX')); | |
$url = "http://finance.google.com/finance/info?"; | |
$ch = curl_init(); | |
$curlConfig = array( CURLOPT_URL => $url.$data, CURLOPT_RETURNTRANSFER => true); | |
curl_setopt_array($ch, $curlConfig); | |
$result = curl_exec($ch); | |
curl_close($ch); |
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
/** | |
* A bunch of basic javascript utilities and helper functions. | |
* Depends on jQuery, Bootstrap. | |
* | |
* @author Prahlad Yeri (prahladyeri@yahoo.com) | |
* */ | |
function retrieveURL(filename) { | |
var scripts = document.getElementsByTagName('script'); | |
if (scripts && scripts.length > 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
<?php | |
/** | |
* Common Utilities Library | |
* | |
* An open source library module for CodeIgniter Framework | |
* | |
* This content is released under the MIT License (MIT) | |
* | |
* Copyright (c) 2016, Prahlad Yeri | |
* |
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
<?php | |
/* | |
* Tool to parse disqus comments xml file. | |
* | |
* @author Prahlad Yeri<prahladyeri@yahoo.com> | |
* @date 2017-09-06 | |
* */ | |
function find_url($root, $thid) { | |
foreach($root->thread as $thread) { |
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
#!/usr/bin/env python3 | |
import sys | |
import subprocess, os | |
from time import sleep, time | |
__author__ = "Prahlad Yeri" | |
__version__ = "1.0.7" | |
def execute_shell(command, error=''): | |
return execute(command, wait=True, shellexec=True, errorstring=error) |
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
#! /usr/bin/env python3 | |
__author__ = "Prahlad Yeri" | |
__license__ = "MIT" | |
__version__ = "0.0.1" | |
import os, sys | |
def print_tree(dirname, pref = ""): | |
for item in os.listdir(dirname): |
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
#!/usr/bin/env python3 | |
import os, sys | |
max_length = 140 | |
def chunks(l, n): | |
for i in range(0, len(l), n): | |
yield l[i:i + n] | |
if __name__ == "__main__": |
OlderNewer