Skip to content

Instantly share code, notes, and snippets.

View itsbalamurali's full-sized avatar
🎯
Focusing

Balamurali Pandranki itsbalamurali

🎯
Focusing
View GitHub Profile
@itsbalamurali
itsbalamurali / random-img.php
Created November 23, 2013 07:27
Randomize Background Image
<?php
$bg = array('bg-01.jpg', 'bg-02.jpg', 'bg-03.jpg', 'bg-04.jpg', 'bg-05.jpg', 'bg-06.jpg', 'bg-07.jpg' ); // array of filenames
$i = rand(0, count($bg)-1); // generate random number size of the array
$selectedBg = "$bg[$i]"; // set variable equal to which random filename was chosen
?>
@itsbalamurali
itsbalamurali / rss.php
Created November 23, 2013 07:26
RSS Generator =========== You'll need a MySQL database with a a table called `rss_feed`. In that table there are 3 colums: item title (which is the name a person will see for an item), the item link (which is the location of the page with the item on it), and description (which tells what the feed is about). Put the file in a folder called feed …
<?php
// Connect to database... (you'll need to create this yourself)
require_once $_SERVER['DOCUMENT_ROOT'] . '/includes/connection.php';
// Run query...
$getFeed = mysql_query("SELECT *
FROM `rss_feed`
ORDER BY `time` DESC
")or die(mysql_error());
@itsbalamurali
itsbalamurali / ipinfo.php
Last active May 6, 2017 07:27
Gist ipinfo
<?php
/* This module is a PHP module that enables the user to find the country, region, city, coordinates, zip code, ISP, domain name, timezone, connection speed, IDD code, area code, weather station code, weather station name, MCC, MNC, mobile brand name, elevation and usage type that any IP address or host name originates from. It has been optimized for speed and memory utilization. Developers can use the API to query all IP2Location™ binary databases for applications supporting PHP.
*/
require_once('IP2Location.php');
// Standard lookup with no cache
$loc = new IP2Location('databases/DB24.BIN');
@itsbalamurali
itsbalamurali / metatags.html
Last active September 20, 2016 00:31
18 Meta Tags Every Webpage Should Have in 2013
<title>Up to 70 Characters of Keyword-relevant text here</title>
<meta name=”description” content=”155 characters of message matching text with a call to action goes here”>
<meta name="author" content="" />
<meta name="copyright" content="&copy;" />
<link rel=”author” href=”https://plus.google.com/[YOUR PERSONAL G+ PROFILE HERE]“/>
<meta property=”og:title” content=”iAcquire’s awesome blog”/>
<meta property=”og:type” content=”article”/>
<meta property=”og:image” content=”http://www.iacquire.com/some-thumbnail.jpg”/>
<meta property=”og:url” content=”http://blog.iacquire.com”/>
<meta property=”fb:admins” content=”USER_ID”/>
<?php
echo "<h1>PHP Code to find the common alphabets in AMITABH BACHCHAN and RAJNIKANTH</h1>";
$string1 = "AMITABH BACHCHAN";
$string2 = "RAJNIKANTH";
$a1 = strlen($string1);
$a2 = strlen($string2);
echo "common alphabets in AMITABH BACHCHAN AND RAJNIKANTH are :\n";
for($i = 0;$i<$a1;$i++)
{
for($j=0;$j<$a2;$j++)
{
"url": "http://itsbalamurali.tk/",
"favicon": "http://g.etfv.co/http://itsbalamurali.tk",
"title": "Hacker's Box",
"description": "A Young Tech Hacker & Web2.0 Entrepreneur's blog",
"image": "http://31.media.tumblr.com/avatar_ab8539606fd9_48.png",
"thumbnail": "http://api.snapito.com/web/DOCS123/sc/http://itsbalamurali.tk"
}
@itsbalamurali
itsbalamurali / parsebot.rb
Created November 15, 2013 07:21
My links (url) parsing api for facebook like link details fetching
#!/usr/bin/env ruby
require 'rubygems'
require 'grape'
require 'favico'
require 'metainspector'
require 'link_oracle'
module Edison
class API < Grape::API
#Response format
@itsbalamurali
itsbalamurali / index.php
Last active December 28, 2015 09:29
Bing Images puller in action http://bingy.herokuapp.com/
<?php
//Bing Images puller in action http://bingy.herokuapp.com/
//this snippet will get the bing.com's current image
$bingimgxml = file_get_contents('http://www.bing.com/HPImageArchive.aspx?format=xml&idx=0&n=1&mkt=en-US');
$bg_img = new SimpleXMLElement($bingimgxml);
$image = $bg_img->image->url;
$img_url ="http://www.bing.com$image";
header('Content-Type: image/jpeg');
readfile($img_url);
//echo $img_url;
require 'hub'
run Sinatra::Application
require 'hub'
run Sinatra::Application