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)
@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:
@Surye
Surye / python.py
Last active August 29, 2015 14:23
import tgl
def cinfo(success, chat):
for userid in chat.user_list:
user = tgl.Peer(type=tgl.PEER_USER, id=userid)
print(user)
def on_msg_receive(msg):
peer = msg.dest
if peer.type is tgl.PEER_CHAT:
import tgl
def info(success, peer):
print(peer.user_list)
def on_msg_receive(msg):
peer = msg.dest
if peer.type is tgl.PEER_CHAT:
tgl.chat_info(peer, info)
import sys
import os
sys.path.append(os.path.dirname(os.path.abspath(__file__))) # TODO Ugly Hack, find a better way
from telegrambot.plugin import TelegramPlugin
from py3owm import OpenWeatherMap
from py3wu import WeatherUnderground
class WeatherPlugin(TelegramPlugin):
{"results":[{"serving_weight":85,"serving_qty":85,"ndb_no":11081,"serving_unit":"g","tier":1,"nutrients":[{"attr_id":255,"value":74.001,"unit":"g","name":"Water","usda_tag":"WATER"},{"attr_id":208,"value":37.4,"unit":"kcal","name":"Energy","usda_tag":"ENERC_KCAL"},{"attr_id":268,"value":156.4,"unit":"kJ","name":"Energy","usda_tag":"ENERC_KJ"},{"attr_id":203,"value":1.428,"unit":"g","name":"Protein","usda_tag":"PROCNT"},{"attr_id":204,"value":0.153,"unit":"g","name":"Total lipid (fat)","usda_tag":"FAT"},{"attr_id":207,"value":0.9520000000000001,"unit":"g","name":"Ash","usda_tag":"ASH"},{"attr_id":205,"value":8.466000000000001,"unit":"g","name":"Carbohydrate, by difference","usda_tag":"CHOCDF"},{"attr_id":291,"value":1.7,"unit":"g","name":"Fiber, total dietary","usda_tag":"FIBTG"},{"attr_id":269,"value":6.766,"unit":"g","name":"Sugars, total","usda_tag":"SUGAR"},{"attr_id":301,"value":13.6,"unit":"mg","name":"Calcium, Ca","usda_tag":"CA"},{"attr_id":303,"value":0.6715,"unit":"mg","name":"Iron, Fe","usda_tag":"F
/* ----------------------------------------------------------------------------
* This file was automatically generated by SWIG (http://www.swig.org).
* Version 3.0.5
*
* This file is not intended to be easily readable and contains a number of
* coding conventions designed to improve portability and efficiency. Do not make
* changes to this file unless you know what you are doing--modify the SWIG
* interface file instead.
* ----------------------------------------------------------------------------- */
/* ----------------------------------------------------------------------------
* This file was automatically generated by SWIG (http://www.swig.org).
* Version 3.0.5
*
* This file is not intended to be easily readable and contains a number of
* coding conventions designed to improve portability and efficiency. Do not make
* changes to this file unless you know what you are doing--modify the SWIG
* interface file instead.
* ----------------------------------------------------------------------------- */