This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#Depth First Search | |
from collections import OrderedDict | |
class priorityQueue: | |
def __init__(self): | |
self.heap=OrderedDict() | |
self.size = 0 | |
def __len__(self): |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
### HW1 due 9/18(mon) | |
# Read "HW1 instruction and notes.docx" | |
# posted on canvas very carefully. | |
# Complete the five functions to upload | |
# them to Vocareum by the due date. | |
import time | |
def isNumber(s): | |
#s must be a non-empty string |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from socket import create_connection | |
MAZE_SERVER = ('54.69.145.229', 16000) | |
RECV_SIZE = 8192 | |
def main(): | |
conn = create_connection(MAZE_SERVER) | |
response = conn.recv(RECV_SIZE) | |
while True: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdio.h> | |
#include <sys/socket.h> | |
#include <arpa/inet.h> //inet_addr | |
#include <string.h> | |
#include <stdarg.h> | |
int sock; | |
char server_reply[512]; | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"pagination":{ | |
"next_url":"https://api.instagram.com/v1/users/30442728/media/recent?access_token=30442728.c3a57bb.1061d7f198b94483be98990c04cb6b53\u0026max_id=1322116412118752986_30442728", | |
"next_max_id":"1322116412118752986_30442728" | |
}, | |
"meta":{ | |
"code":200 | |
}, | |
"data":[ | |
{ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ data: | |
[ { likes: 1057, day: 1480541883 }, | |
{ likes: 1037, day: 1479774405 }, | |
{ likes: 837, day: 1479344298 }, | |
{ likes: 1023, day: 1479087523 }, | |
{ likes: 1092, day: 1478829766 }, | |
{ likes: 1320, day: 1478653189 }, | |
{ likes: 1018, day: 1478477061 }, | |
{ likes: 47 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
"use strict" | |
var twit = require("twit"); | |
var Promise = require('bluebird') | |
var file = Promise.promisifyAll(require('fs-extra')); | |
var request = Promise.promisify(require('request')); | |
var bodyParser = require('body-parser'); | |
var hour = (60 * 1000) | |
setInterval(checkTime, hour) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function updateUsers() { | |
console.log("Updating User Data Across Server!") | |
var date = new Date(); | |
var users = file.readdirSync('users/') | |
for (var i = 0; i<users.length; i++) { | |
var links = file.readdirSync('users/' + users[i]) | |
for (var k = 0; k<links.length; k++) { | |
var files = file.readdirSync('users/' + users[i] + '/' + links[k]) | |
if (files == "instagram.json") { | |
var data = file.readFileSync('users/' + users[i] + '/' + links[k] + '/instagram.json', "utf-8") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function createInsta(email, userid) { | |
var exits = fs.existsAsync('users/' + email + '/' + userid).then(function(exists) { | |
var mkdir = fs.mkdirAsync('users/' + email + '/' + userid).catch(function(error) { | |
console.log(error) | |
}) | |
var readData = fs.readFileAsync("data/data.json", "utf-8").then(function(contents) { | |
var writeNew = fs.writeFileAsync('users/' + email + '/' + userid + '/instagram.json', contents).then(() => { | |
initInsta(email, userid) | |
}).catch(function(error) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function createInsta(email, userid, cb) { | |
ensureExists(function (error) { | |
if (error) return cb(error); | |
getData(function (error) { | |
if (error) return cb(error); | |
}); | |
}); | |
NewerOlder