Skip to content

Instantly share code, notes, and snippets.

@calebcgates
calebcgates / test_input.php
Created July 26, 2016 14:46
PHP test_input
<?php
// define variables and set to empty values
$name = $email = $gender = $comment = $website = "";
if ($_SERVER["REQUEST_METHOD"] == "POST") {
$name = test_input($_POST["name"]);
$email = test_input($_POST["email"]);
$website = test_input($_POST["website"]);
$comment = test_input($_POST["comment"]);
$gender = test_input($_POST["gender"]);
@calebcgates
calebcgates / vim_commands.txt
Last active November 1, 2016 21:28
Vim Commands
:set number
:set autoindent
:set tabstop=4
:imap jj <Esc>
v /word Enter //begin visual select and select until first occurance of word
0 // beginning of line
gm // go to middle
gg // go to bottom
G // go to top
@calebcgates
calebcgates / Web_Scraper_Python.py
Created July 26, 2016 16:37
Web Scraper Python LXML & XPATH
################################################################################################################
################################################################################################################
# purpose of this program is to scrap data from a page using lxml and Xpath
# original tutorial found at http://docs.python-guide.org/en/latest/scenarios/scrape/
# here we go
### was told to install lxml using
### pip install lxml ###CONTINUE READING BEFORE INSTALLING
### pip install requests ###CONTINUE READING BEFORE INSTALLING
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>The HTML5 Herald</title>
<meta name="description" content="The HTML5 Herald">
<meta name="author" content="SitePoint">
<?php
//http://stackoverflow.com/questions/3080146/post-data-to-a-url-in-php
$url = 'http://www.someurl.com';
$myvars = 'myvar1=' . $myvar1 . '&myvar2=' . $myvar2;
$ch = curl_init( $url );
curl_setopt( $ch, CURLOPT_POST, 1);
curl_setopt( $ch, CURLOPT_POSTFIELDS, $myvars);
curl_setopt( $ch, CURLOPT_FOLLOWLOCATION, 1);
<?php
//http://stackoverflow.com/questions/3080146/post-data-to-a-url-in-php
$url = 'http://phonebook.uconn.edu/results.php';
// status => any
// basictext => (30 char limit) > this is a name
$status = 'any';
$basictext = 'Caleb Gates';
$myvars = 'status='.$status.'&basictext='+$basictext; //= 'myvar1=' . $myvar1 . '&myvar2=' . $myvar2;
$ch = curl_init( $url );
sudo apt-get install python-pip
#http://blog.rhesoft.com/2014/05/24/how-to-build-python-application-for-android-ios-and-desktop/
pip install --upgrade buildozer
easy_install buildozer
pip install --upgrade cython #use pip or other tool to install cython
'use strict';
/**
* This sample demonstrates a simple skill built with the Amazon Alexa Skills Kit.
* The Intent Schema, Custom Slots, and Sample Utterances for this skill, as well as
* testing instructions are located at http://amzn.to/1LzFrj6
*
* For additional samples, visit the Alexa Skills Kit Getting Started guide at
* http://amzn.to/1LGWsLG
*/
'use strict';
/**
* This sample demonstrates a simple skill built with the Amazon Alexa Skills Kit.
* The Intent Schema, Custom Slots, and Sample Utterances for this skill, as well as
* testing instructions are located at http://amzn.to/1LzFrj6
*
* For additional samples, visit the Alexa Skills Kit Getting Started guide at
* http://amzn.to/1LGWsLG
*/
//
// Copyright Caleb Gates 2017
//
'use strict';
const AWS = require('aws-sdk');
AWS.config.region = 'us-east-1';
var lambda = new AWS.Lambda();
const docClient = new AWS.DynamoDB.DocumentClient({region: 'us-east-1'});