Skip to content

Instantly share code, notes, and snippets.

View EricTendian's full-sized avatar
🕵️‍♂️
Stay curious.

Eric Tendian EricTendian

🕵️‍♂️
Stay curious.
View GitHub Profile
@EricTendian
EricTendian / iitalert.php
Created August 26, 2014 02:58
A webhook for safety alert emails, built to work with the Illinois Institute of Technology's alert system. This script posts alert messages to a Facebook group as soon as the POST request is made.
<?php
/**
* IIT Alert notification app
* Created by: Eric Tendian
* This script is meant to be kicked off by cloudmailin.com upon a new email.
*
* Access token last generated: 25 August 2014
*
* To generate a new token, first visit the URL:
* https://graph.facebook.com/oauth/authorize?type=user_agent&client_id=[YOUR APP ID]&redirect_uri=[YOUR REDIRECT URL]&scope=user_groups,publish_actions
@EricTendian
EricTendian / CTA_alphaTags.py
Created July 27, 2014 03:18
This script writes the title of a SDR# (SDRSharp) Frequency Scanner plugin window to a textfile, to be read by ProScan and fed into Icecast2 metadata. In this case, it is used for streaming Chicago Transit Authority radio traffic. However, it can be adapted to save other window titles given a certain flag to look for. Use this script in the even…
import win32gui, time
def enum_window_titles():
def callback(handle, data):
titles.append(win32gui.GetWindowText(handle))
titles = []
win32gui.EnumWindows(callback, None)
return titles
@EricTendian
EricTendian / Eric_Tendian_IT_Resources.md
Last active August 29, 2015 13:56
A various list of the IT websites/resources I use often or have bookmarked.
@EricTendian
EricTendian / ysradar.py
Last active January 3, 2016 18:09
Version 2.0 beta for use with YSFlight network version 20110207
#!/usr/bin/env python
from socket import *
from random import randrange
import sys, os, threading, re, math, time, urllib, string, struct
try: import psyco; psyco.full()
except: pass
@EricTendian
EricTendian / calcGrades-vector.cpp
Last active December 26, 2015 06:49
Reads a file called grades.txt with a list of grades, one on each line, and outputs the average of all the numbers, as well as the lowest and highest score. Uses vectors to account for an unlimited number of grades.
#include <iostream>
#include <fstream>
#include <vector>
using namespace std;
double findAvg(vector<double>);
double min_max(vector<double>, bool);
int main() {
vector<double> grades;
@EricTendian
EricTendian / calcGrades.cpp
Last active December 26, 2015 06:49
Reads a file called grades.txt with 20 grades, one on each line, and outputs the average of all the numbers.
#include <iostream>
#include <fstream>
using namespace std;
const int STUDENTS = 20;
double findAvg(int[]);
int main() {
int grades[STUDENTS] ;
@EricTendian
EricTendian / favicon-colors
Created July 26, 2013 23:12
Nginx rewrite config for colored favicons, based on subdomain. If you have your dev. codebase, staging/qa. codebase, and your prod. codebase on the same server, you can give them different favicons to differentiate between the different branches. All subdomains that start with dev (such as dev.example.com and dev.app.example.com) would get the r…
location ~* /favicon(.*) {
log_not_found off;
access_log off;
root /var/www/default;
}
location = /favicon.ico {
if ($host ~* ^dev\.) {
rewrite ^/favicon\.ico$ /favicon-red.ico last;
}
if ($host ~* ^qa\.) {
@EricTendian
EricTendian / yearCalc.php
Created May 27, 2013 20:52
Calculate what year in a 4-year program (high school or college) you are in based off of your graduation year. $gradYear is your graduation year, and $year corresponds to your current year (1-Freshman, 2-Sophomore, 3-Junior, 4-Senior).
<?php
$currentMonth = date("m", time());
$currentYear = date("Y", time());
if (7 > $currentMonth < 12) $year = 4 - ($gradYear - ($currentYear+1));
else $year = 4 - ($gradYear - ($currentYear));
?>
@EricTendian
EricTendian / freenode-irc.php
Created December 2, 2012 23:35
freenode IRC chat in MyBB
<?php
define("IN_MYBB", 1); //init mybb
require('global.php'); //make sure this is being executed in the same dir as global.php or change accordingly
if ($mybb->user['uid'] > 0)
{
$uid = $mybb->user['uid'];
$user = get_user($uid);
$name = $user['username'];
} else $name = "anon".rand(1, 100); //since user is not logged in
?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>NCP Tech Squared - Northside's one and only computer club</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="description" content="">
<meta name="author" content="">
<!-- Le styles -->