Skip to content

Instantly share code, notes, and snippets.

View alfredfrancis's full-sized avatar
🎯
Focusing

Alfred Francis alfredfrancis

🎯
Focusing
View GitHub Profile
@alfredfrancis
alfredfrancis / BulkSMS.PHP
Last active August 29, 2015 14:10
Bulk SMS Script
<?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
@alfredfrancis
alfredfrancis / gist:a69c6388b78de04b56ba
Last active August 29, 2015 14:11
expire at 24:00
<?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);
?>
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/
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)
<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");
<?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');
$(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 June 23, 2016 10:48 — forked from fnielsen/gist:1226214
Email classification example with Python, NLTK, ...
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) ])
[
{
"cronPattern": "* * * * *",
"serviceProviderID": "LULUXKW#####",
"bankName": "The City Bank",
"transferMode": "WWW",
"ftpUrl": "null",
"maximumAttemptsNo": 4,
"passwordExpFreq": 30,
"testkey": false,
import os
import pickle
from sklearn.feature_extraction.text import TfidfVectorizer
from sklearn.naive_bayes import MultinomialNB
from sklearn.pipeline import Pipeline
def train(X, y,outpath=None, verbose=True):
def build(X, y=None):
"""