Skip to content

Instantly share code, notes, and snippets.

View Surye's full-sized avatar

Vincent Castellano Surye

View GitHub Profile
import http.server
import socketserver
import os.path
def make_http_handler(root_path):
class HTTPHandler(http.server.BaseHTTPRequestHandler):
def __init__(self, *args, **kwargs):
super(HTTPHandler, self).__init__(*args, **kwargs)
#!/bin/env python
import random
from functools import reduce
from collections import Counter
class PongSim:
skills = [[0,0],[0,0]]
#!/bin/env python
import random
from sys import argv
from functools import reduce
from collections import Counter
class PongSim:
skills = [[0,0],[0,0]]
@Surye
Surye / vsprintf_issue.cpp
Created February 24, 2012 06:12
vsprintf issue
#include <cstdarg>
#include <string>
#include <iostream>
void debug(std::string c_fmt, ...);
int main() {
debug("Testing: %d", 12345); // Testing: -858993460
}
@Surye
Surye / MFPNetCarbs.user.js
Created February 1, 2012 04:14
Greasemonkey script for MFP Ketoers
// ==UserScript==
// @name MyFitnessPal Percentages and Net Carbs
// @version 1.1
// @namespace surye
// @description Adds display of Carb/Protein/Fat percentages to any daily food diary page. Also adds "Real Calories" calcalation based off 4/4/9 algorithm. Based on "MyFitnessPal Percentages", modified by Surye to add low carb features such as net carbs. Requires the following columns: Fat, Protein, Carbs, Fiber
// @include http://www.myfitnesspal.com/food/diary/*
// ==/UserScript==
/* side note - 5/30/65 Carbs/Protein/Fat is a good ratio for fat loss */
// ==UserScript==
// @name MyFitnessPal Percentages and Net Carbs
// @version 1.0.5
// @namespace surye
// @description Adds display of Carb/Protein/Fat percentages to any daily food diary page. Also adds "Real Calories" calcalation based off 4/4/9 algorithm. Based on "MyFitnessPal Percentages", modified by Surye
// @include http://www.myfitnesspal.com/food/diary/*
// ==/UserScript==
/* side note - 5/30/65 Carbs/Protein/Fat is a good ratio for fat loss */
// ==UserScript==
// @name MyFitnessPal Percentages and Net Carbs
// @version 1.0.5
// @namespace surye
// @description Adds display of Carb/Protein/Fat percentages to any daily food diary page. Also adds "Real Calories" calcalation based off 4/4/9 algorithm. Based on "MyFitnessPal Percentages", modified by Surye
// @include http://www.myfitnesspal.com/food/diary/*
// ==/UserScript==
/* side note - 5/30/65 Carbs/Protein/Fat is a good ratio for fat loss */
@Surye
Surye / TB
Last active August 29, 2015 14:24 — forked from anonymous/TB
from twx.botapi import TelegramBot, ReplyKeyboardMarkup
"""
Setup the bot
"""
bot = TelegramBot('116456440:AAEys8uNPIONg-7nYWDb5Qob1K1KS2cuBjc')
bot.update_bot_info().wait()
print(bot.username)
import tgl
users = []
def cinfo(success, chat):
for userid in chat.user_list:
user = tgl.Peer(type=tgl.PEER_USER, id=userid)
users.append(user)
if user.username == 'Surye':
tgl.create_group_chat(users, "Testing You Can leave")
import tgl
def cinfo(success, chat):
for userid in chat.user_list:
user = tgl.Peer(type=tgl.PEER_USER, id=userid)
print(user)
def dlist(success, dialog_list):
for dialog in dialog_list:
if dialog['peer'].type is tgl.PEER_CHAT: