Skip to content

Instantly share code, notes, and snippets.

Avatar
🏠
Working from home

Alfred Francis alfredfrancis

🏠
Working from home
View GitHub Profile
@alfredfrancis
alfredfrancis / BulkSMS.PHP
Last active Aug 29, 2015
Bulk SMS Script
View BulkSMS.PHP
<?php
include_once "alfa.sms.class.php";
$servername = "localhost";
$username = "username";
$password = "password";
$dbname = "myDB";
// Create connection
$conn = new mysqli($servername, $username, $password, $dbname);
// Check connection
View gist:59649107459c86e5f977
/* Starts an APK download attempt */
var MarketSession = {
/**
* Called when pressing the APK Downloader icon in the location bar.
*/
download: function(packageName, versionCode, tabId) {
BrowserStorage.get(["account", "sim"], function(items) {
if (!items.account || !items.sim) {
//alert("Please setup your device in the Options page first");
BrowserTabs.create({
View gist:a69c6388b78de04b56ba
<?php
$ts1 = strtotime(str_replace('/', '-', '24:00:00'));
$ts2 = strtotime(str_replace('/', '-', date('H:i:s')));
$diff = (abs($ts1 - $ts2) * 1000);
setcookie('expire', 'test',+$diff);
?>
View capswitch.py
import wiringpi
import time
# 1M external pull-up resistor
# 1) set pin low and to output to discharge
# 2) make the pin an input without the internal pull-up on
# 3) read input and see how long it takes to go high
# ref: https://github.com/WiringPi/WiringPi-Python
# pins: https://projects.drogon.net/raspberry-pi/wiringpi/pins/
View parser.py
def doAction(str2):
words = str2.split()
if words[0] == 'set':
a = re.compile(' set an alarm for (\w+ \w*) (am|pm)')
m = a.match(str2)
if m:
print(m.group(1), m.group(2))
setAlarm(m.group(1), m.group(2))
else:
print(str2)
View simple_captch.php
<html>
<head>
prove that you are not a bot.type the word you see in the screen
</head>
<body>
<?php
session_start();
if(!isset($_SESSION["random"]) || !isset($_POST['user']) )
{
$random = str_shuffle("dgds235");
View geo_decode.php
<?php
function getCoordinates($location)
{
$address = str_replace(" ", "+", $location);
$url = "http://maps.google.com/maps/api/geocode/json?sensor=false&address=$location";
$response = file_get_contents($url);
$json = json_decode($response,TRUE);
return ($json['results'][0]['geometry']['location']['lat'].",".$json['results'][0]['geometry']['location']['lng']);
}
echo getCoordinates('gandhinagar,jaipur');
View script.js
$(document).ready(function() {
var NS = {};
var put_text = function(bot_say) {
html_data = '<div class="alert alert-success fade in">\
<a href="#" class="close" data-dismiss="alert">&times;</a>';
$.each(bot_say["responseJSON"], function (index, data) {
html_data = html_data + index +" : "+data+"<br>";
})
@alfredfrancis
alfredfrancis / gist:4b54c8eebc1e01815a5bac6bc555022d
Created Jun 23, 2016 — forked from fnielsen/gist:1226214
Email classification example with Python, NLTK, ...
View gist:4b54c8eebc1e01815a5bac6bc555022d
documents = [ dict(
email=open("conference/%d.txt" % n).read().strip(),
category='conference') for n in range(1,372) ]
documents.extend([ dict(
email=open("job/%d.txt" % n).read().strip(),
category='job') for n in range(1,275)])
documents.extend([ dict(
email=open("spam/%d.txt" % n).read().strip(),
category='spam') for n in range(1,799) ])
View gist:28aaf2190311672450f482ba71f2cb76
[
{
"cronPattern": "* * * * *",
"serviceProviderID": "LULUXKW#####",
"bankName": "The City Bank",
"transferMode": "WWW",
"ftpUrl": "null",
"maximumAttemptsNo": 4,
"passwordExpFreq": 30,
"testkey": false,