Skip to content

Instantly share code, notes, and snippets.

View prahladyeri's full-sized avatar
🏠
Working from home

Prahlad Yeri prahladyeri

🏠
Working from home
View GitHub Profile
@prahladyeri
prahladyeri / disqus_parse.php
Created September 7, 2017 08:53
Tool to parse disqus comments xml file
<?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) {
@prahladyeri
prahladyeri / console.php
Last active March 29, 2020 03:44
Tool to import disqus comments to the wordpress system.
<?php
/*
* Tool to migrate disqus comments to the wordpress system.
*
* @author Prahlad Yeri<prahladyeri@yahoo.com>
* @date 2017-09-06
*
* Updated on 2020-03-11: fixes and refactoring.
* */
require_once('disqus_parse.php');
@prahladyeri
prahladyeri / flask_drive_example.py
Created December 30, 2016 12:51
google drive api implementation in python-flask framework
##
# Flask Drive Example App
#
# @author Prahlad Yeri <prahladyeri@yahoo.com>
# @date 30-12-2016
# Dependency:
# 1. pip install flask google-api-python-client
# 2. make sure you have client_id.json in this same directory.
import os
<?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);
@prahladyeri
prahladyeri / utils.js
Created December 24, 2016 14:14
A bunch of basic javascript utilities and helper functions
/**
* 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) {
@prahladyeri
prahladyeri / Utils.php
Last active December 30, 2016 18:36
An open source utility module for CodeIgniter Framework
<?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
*
@prahladyeri
prahladyeri / Product.java
Last active December 17, 2015 09:04
Rockstar Java Dev series: Using Lambda expressions
import java.util.ArrayList;
import java.util.List;
import java.util.function.Predicate;
interface ProductFilter
{
public boolean run(Product p);
}
public class Product
@prahladyeri
prahladyeri / nice_reddit.user.js
Last active November 2, 2017 08:12
A Firefox user script to mark unread Reddit comments in blue background
// ==UserScript==
// @name Nice Reddit
// @namespace com.prahladyeri.userscripts.nice_reddit
// @creator prahladyeri@yahoo.com
// @description Beautify your Reddit!
// @homepage http://www.prahladyeri.com
// @include http://*.reddit.com/*
// @include https://*.reddit.com/*
// @require http://ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js
// @version 1.2
#!/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()
@prahladyeri
prahladyeri / handy.js
Created June 15, 2015 17:49
Custom javascript library for doing misc things.
/**
* @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.