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 / 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 / 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 / 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 / playzone.sh
Last active August 29, 2015 14:09
Use this shell script to play a specific Broadcastify #ChicagoScanner stream on your Linux computer. Currently uses omxplayer for use with a Raspberry Pi.
#!/bin/bash
case $1 in
'Chicago Police Department'|'cpd')
omxplayer http://relay.broadcastify.com:80/il_chicago_police2.mp3
;;
'Chicago Police - Citywide 1'|'cw1')
omxplayer http://relay.broadcastify.com:80/128024765.mp3
;;
'Chicago Police - Citywide 6'|'cw6')
@EricTendian
EricTendian / import_fb_chat_to_slack.js
Last active August 29, 2015 14:17
Use this little jQuery script to help create a CSV from a Facebook chat. You'll need to copy the ul element with id webMessengerRecentMessages and everything inside it to a new HTML file, and then include jQuery. From there you can open up devtools, paste in this script, and get an output. Then copy that output into a new textfile, save it, chan…
$("li.webMessengerMessageGroup > div.clearfix > div.clearfix._42ef").each(function () {
var line = '"'+Math.round($(this).find("div.rfloat._ohf abbr").attr("data-utime"))+'","general","'+$(this).find("div:nth-child(2) > strong > a").text()+'",';
$(this).find("div:nth-child(2) > div > div._53 > div").each(function () {
var text = $(this).find("div._38.direction_ltr > span > p").text().replace("\n","\\n");
if (text.length) console.log(line + '"'+text+ "\"\n");
});
});
@EricTendian
EricTendian / Subsonic_Share2FB.php
Created August 12, 2012 22:46
Subsonic song sharing via fbcmd
<?php
// This script posts a song to your Facebook wall.
// Author: Eric Tendian (erict15) erictendian[at]gmail[dot]com
// Last Modified: Aug 12 2012 @ 22:42GMT
// NOTE: Change the REST version (v. 1.8.0) based on Subsonic version. See http://www.subsonic.org/pages/api.jsp for more info.
// server and login info
$user = "username"; //Subsonic username (must have sharing permissions)
$pass = "password"; //Subsonic password
$serverURL = "http://hostname:port"; //Subsonic server URL
<!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 -->
@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
?>
@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 / 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] ;