Skip to content

Instantly share code, notes, and snippets.

View EsteveSegura's full-sized avatar
❄️
Focusing

Esteve Segura EsteveSegura

❄️
Focusing
View GitHub Profile
@EsteveSegura
EsteveSegura / TwitchManager.cs
Created March 9, 2020 15:37
Unity + twitch chat.
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using System;
using System.ComponentModel;
using System.Net.Sockets;
using System.IO;
public class TwitchIntegration : MonoBehaviour{
@EsteveSegura
EsteveSegura / tips.html
Created November 4, 2019 18:41
tips.html
<!DOCTYPE html>
<html lang="es">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/animate.css/3.7.2/animate.min.css">
<title>neighborhoodSign</title>
<style>
@EsteveSegura
EsteveSegura / admin.js
Created November 4, 2019 18:19
admin.ejs
//Collecting data using jquery
function collectData(id) {
let dataCollected = { 'name': "", data: [] }//[]
$(`#${id}`).children('').each((i, el) => {
dataCollected.name = el.id.slice(0, -1);
if (el.tagName == "INPUT") {
dataCollected.data.push({ 'name': el.id, 'data': $(el).val() })
}
})
return dataCollected
@EsteveSegura
EsteveSegura / server.js
Created November 4, 2019 18:12
server.js
const http = require('http');
const morgan = require('morgan');
const express = require('express');
const bodyParser = require('body-parser');
const socketIo = require('socket.io');
const app = express();
const server = http.createServer(app);
const routes = require('./routes/routes');
const io = socketIo(server);
@EsteveSegura
EsteveSegura / bot.js
Created October 21, 2019 21:11
bot js final file
const download = require('image-downloader')
const detectFood = require('./detectFood');
//read txt file and convert to array
function readFileLineByLine(dataPath){
return new Promise(function(resolve,reject){
let dataset = []
let rl = readline.createInterface({
input: fs.createReadStream(dataPath)
Have you cooked it? good. I only perceive one thing from this cheeseburger: flavor
Wow.... That burger just 'good cooking'. Can i bite it
I want to try that food, it looks delectable. Wow.... That burger just 'flavor'
Too delicious. The burger talks about ''good cooker''
I want to try that food, it looks delicious. looking that burger you can perceive: good cooking
Wow.... That burger just 'good cooking'. The photo tells me that i must attack it
It seems delicious. I only perceive one thing from this cheeseburger: made with love
I want to try that food, it looks delectable. Wow.... That burger just 'good cooking'
I only perceive one thing from this cheeseburger: good cooker. I want to eat it
That food looks like fine. I only perceive one thing from this cheeseburger: good cooker
const download = require('image-downloader')
const detectFood = require('./detectFood');
//download instagram post
async function downloadPost(ig,media_id){
try {
let postToDownload = await getMediaIdInfo(ig,media_id);
let downloadedData = await downloadImageFromUrl(postToDownload.items[0].image_versions2.candidates[0].url,media_id);
return downloadedData;
} catch (error) {
@EsteveSegura
EsteveSegura / bot.js
Created October 21, 2019 18:03
instagram bot
//instagram workflow
(async () => {
let ig = await login(); //login
await setAntiBanMode(ig); //anti-ban Mode
//repeat this every hour
setInterval(async () => {
let posts = await recentHashtagList(ig, "foodporn"); //get all hashtags in #foodporn hashtag
for(let i = 0 ; i < posts.length ; i++){
let actualPost = await downloadPost(ig,posts[i].pk) //download picture
@EsteveSegura
EsteveSegura / bot.js
Last active October 21, 2019 18:00
instagram vot
const download = require('image-downloader')
const detectFood = require('./detectFood');
//download instagram post
async function downloadPost(ig,media_id){
try {
let postToDownload = await getMediaIdInfo(ig,media_id);
let downloadedData = await downloadImageFromUrl(postToDownload.items[0].image_versions2.candidates[0].url,media_id);
return downloadedData;
} catch (error) {
@EsteveSegura
EsteveSegura / detectfood.js
Created October 21, 2019 17:34
detect food js
const spawn = require('child_process').spawn;
//create friendly js prediction
function decodePrediction(str){
let decode = str.split('-');
return {
"label" : decode[0],
"percentage" : Math.trunc(decode[1])
}
}