Skip to content

Instantly share code, notes, and snippets.

View michvaldes001's full-sized avatar

michvaldes001

View GitHub Profile
@michvaldes001
michvaldes001 / Quick_Gallery.php
Created July 29, 2017 22:51
A quick and simple photo gallery.
@michvaldes001
michvaldes001 / Candidate_Media_Negativity_Graph.php
Last active May 4, 2016 16:03
This is the script I use on my server to graph media negativity towards each candidate. It runs daily as a cron job.
<?php
require_once('store_data.php');
class CANDIDATE_DATA_GRAPH
{
private function scan_news_data($first_name, $last_name)
{
@michvaldes001
michvaldes001 / MV_graph.php
Last active April 20, 2016 05:07
MV Graphing Library
<?php
//This is a simple library to create bar and line graphs from data array.
//Usage:
//$graph_instance = new GRAPH_CREATE()
//$graph_instance _> gather_data(<'bar_graph' or 'line_graph'>, <height in pixels>, <width in pixels>, <data array (requres
//a sub array with 'label' key and data points to be in sub array with 'value' key)>, <min data point>,
//<max data point>,<text file name to save data in>, <array with RGB color values for graph>,<1 for automatically scaling graph
//to data>, <percentage from min/max value to space graph from top/bottom edge>);
@michvaldes001
michvaldes001 / simple_file_manager.php
Last active March 30, 2016 16:29
A PHP based file manager back end.
<?php
//Change directory based on input from URL.
function change_directory()
{
//If a directory variable is present in URL, change directory to match.
if (isset($_GET['dir_change']))
{
$directory_to_change = $_GET['dir_change'];
chdir($directory_to_change);
@michvaldes001
michvaldes001 / election_2016.php
Last active March 20, 2016 00:34
This script is a crude attempt at analyzing the media's tone for each candidate. See comments in code.
<?php
//This script is my crude attempt of trying to quantify the media's tone pertaining to articles about candidates.
//The script scans the 5 most heavily trafficked news sites that have a search function.
//It searches and counts key negative and positive adjectives.
//I excluded Fox News as that would skew my results.
//Working demo here: http://michvaldes001.ddns.net/index.php?section_id=Apps&app_loaded=yes&app_id=election_2016
//Display header.
echo '<h2>Words Used to Describe Candidates (data from Google, Yahoo, CNN, NBC, and NYT news).</h2>';
@michvaldes001
michvaldes001 / photo_gallery.php
Last active March 10, 2016 04:12
PHP based self updating photo gallery.
@michvaldes001
michvaldes001 / text_to_dna_encode.php
Last active March 9, 2016 16:22
PHP Text to DNA encoder.
<?php
#Demo here: http://michvaldes001.ddns.net/index.php?section_id=Web_Apps&app_id=text_to_dna&name=Testing
#Generate user input box.
echo "<h3>Please Enter Your First Name</h3>
<form id='name_form' action = '<LOCATION OF TEXT_TO_DNA_ENCODE_REDIRECT.PHP>'>
<input name='name_submit' type='text' id='name_s'>
<button type='submit'>Submit</button>
</form>";
@michvaldes001
michvaldes001 / IR_vision_overlay.py
Created October 11, 2015 15:07
This simple bit of code is for a project I'm working on. I intend to to simulate what it would look like if we has an extra cone in our eyes sensitive to near infrared light. This can be done by overlaying the feed of an IR camera over that of a normal camera. In reality we can't really conceive this new color. It would be akin to a colorblind p…
#must have OpenCV installed
import cv2
#gets video feed from both cameras (this is for Linux)
cam = cv2.VideoCapture(0)
cam2 = cv2.VideoCapture(1)
#main loop
while True:
#process video feeds
import cv2
import numpy as np
AT_image = cv2.imread("AT.jpg")
TA_image = cv2.imread("TA.jpg")
CG_image = cv2.imread("CG.jpg")
GC_image = cv2.imread("GC.jpg")
dna_render_list = []
@michvaldes001
michvaldes001 / Camara_motion_capture.py
Last active August 29, 2015 14:18
Python + Arduino motion to LED display
#!/usr/bin/env python
import cv2, serial, time
#motion detect
def diffImg(t0, t1, t2):
d1 = cv2.absdiff(t2, t1)
d2 = cv2.absdiff(t1, t0)
return cv2.bitwise_and(d1, d2)