Skip to content

Instantly share code, notes, and snippets.

View lucaspg96's full-sized avatar

Lucas Peres lucaspg96

View GitHub Profile
@lucaspg96
lucaspg96 / bot.py
Last active November 11, 2024 17:26
A python script to send messages to a telegram user. Useful to notify when long scripts are finished!
#This script is independet of lib or python version (tested on python 2.7 and 3.5)
import telegram
#token that can be generated talking with @BotFather on telegram
my_token = ''
def send(msg, chat_id, token=my_token):
"""
Send a mensage to a telegram user specified on chatId
chat_id must be a number!
def decode(s):
return " ".join([chr(int(n)) for n in s.split(" ") if n!='32'])
def encode(s):
return " ".join([str(ord(c)) for c in s])
var mysql = require('mysql')
var connection = mysql.createConnection({
host: "localhost",
user: process.env.USER_MYSQL,
password: process.env.PASS_MYSQL,
database: "test"
})
connection.connect()
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@lucaspg96
lucaspg96 / check.py
Last active November 23, 2017 17:21
from pymongo import MongoClient as mc
collection = mc().datavis.menus
found = 0
not_found = 0
with open("locations-2017-11-16 12:42:08.068035.txt") as f:
for line in f:
place,coords= line.split(" -> ")
if not collection.find_one({"place":place}):
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.