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
# Copyright 2010-2019 Amazon.com, Inc. or its affiliates. All Rights Reserved. | |
# | |
# This file is licensed under the Apache License, Version 2.0 (the "License"). | |
# You may not use this file except in compliance with the License. A copy of the | |
# License is located at | |
# | |
# http://aws.amazon.com/apache2.0/ | |
# | |
# This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS | |
# OF ANY KIND, either express or implied. See the License for the specific |
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
## Get Number of unique elements in a list | |
x = ['f', 'e', 'e', 'f', 'f'] | |
# output: {'e': 2, 'f': 3} | |
# Solution | |
o = {i:x.count(i) for i in x} | |
print(o) | |
#----------------------------------------------------------------------------------------------------- | |
## Get Number of unique elements in dict |
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
def sendSMS(clientId,msg): | |
cmd = """wget "https://nxyz.com/LATEST/001?module=profile&clientId=%s" -O clientprofile.json""" % clientId | |
os.system(cmd) | |
dataDict = None | |
with open('clientprofile.json') as bIN: | |
dataDict = json.load(bIN) | |
mobile = dataDict.get('mobile') | |
mstatus = dataDict.get('phoneStatus') | |
## Validate Mobile Status | |
if mstatus == 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
## Problem : Get Number of unique elements in a list | |
x = ['f', 'e', 'e', 'f', 'f'] | |
# output {'e': 2, 'f': 3} | |
##Solution | |
o = {i:x.count(i) for i in x} | |
print(o) | |
## Problem : Get Number of unique values in a dict |
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
<script type="text/javaScript"> | |
$(document).ready(function(){ | |
$.getJSON("http://getthirukural.appspot.com/api/2.0/kural/<?php echo $start;?>-<?php echo $end;?>?appid=m8gzum7bzuank&format=json&jsoncallback=?", function(data){ | |
var result=""; | |
$.each(data.KuralSet.Kural, function(i,Kural){ | |
result += "#"+Kural.Number+"<br>"+Kural.Line1+"<br>"+Kural.Line2+"<br><span class='label-warning'> "+Kural.Translation+"</span><br><BR>"; | |
}); | |
$('#ptable').html(result); | |
}); |
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 | |
function checkSum($ccnum) { | |
$checksum = 0; | |
for ($i=(2-(strlen($ccnum) % 2)); $i<=strlen($ccnum); $i+=2) | |
{ | |
$checksum += (int)($ccnum{$i-1}); | |
} | |
for ($i=(strlen($ccnum)% 2) + 1; $i<strlen($ccnum); $i+=2) | |
{ | |
$digit = (int)($ccnum{$i-1}) * 2; |
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 | |
$search_url = (@$_GET['url']) ? : "http://ngiriraj.com/pincode/"; | |
$api_key = "xxxxxxxxxxxxxxxxxxx"; | |
//https://console.developers.google.com/ | |
$speed_url = "https://www.googleapis.com/pagespeedonline/v1/runPagespeed?url=".$search_url."&key=".$api_key; | |
print "URL : <BR>".$search_url; | |
$ch = curl_init ($speed_url); | |
curl_setopt($ch, CURLINFO_HEADER_OUT, true); |
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 | |
/* | |
@author : Giriraj Namachivayam | |
@date : Apr 2, 2013 | |
@demourl : http://ngiriraj.com/socialMedia/oauthlogin/geni.php | |
@document : http://ngiriraj.com/work/geni-connect-by-using-oauth-in-php/ | |
@license : Free to use, | |
@History : V1.0 - Released oauth 2.0 service providers login access | |
@oauth2 : Support following oauth2 login | |
Bitly |
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 | |
/* | |
@author : Giriraj Namachivayam | |
@date : Mar 20, 2013 | |
@demourl : http://ngiriraj.com/socialMedia/oauthlogin/stocktwits.php | |
@document : http://ngiriraj.com/work/stocktwits-connect-by-using-oauth-in-php/ | |
@license : Free to use, | |
@History : V1.0 - Released oauth 2.0 service providers login access | |
@oauth2 : Support following oauth2 login | |
Bitly |
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 | |
/* | |
@author : Giriraj Namachivayam | |
@date : Mar 20, 2013 | |
@demourl : http://ngiriraj.com/socialMedia/oauthlogin/meetup.php | |
@document : http://ngiriraj.com/work/meetup-connect-by-using-oauth-in-php/ | |
@license : Free to use, | |
@History : V1.0 - Released oauth 2.0 service providers login access | |
@oauth2 : Support following oauth2 login | |
Bitly |
NewerOlder