Skip to content

Instantly share code, notes, and snippets.

View edonosotti's full-sized avatar
😼
Writing

Edoardo Nosotti edonosotti

😼
Writing
View GitHub Profile
@edonosotti
edonosotti / formula.md
Created March 19, 2018 12:04
Microsoft Excel formula to convert ISO 8601 date with milliseconds resolution to time stamp

Formula

This will convert an ISO 8601 date such as: 2018-03-19T10:18:08.137747874Z

to a timestamp with milliseconds resolution: 1521454688137,00

Please note that the decimal part (,00) can be stripped away, milliseconds are the last three digits.

=(((DATEVALUE(LEFT(A1;10))+TIMEVALUE(MID(A1;12;8)))-DATE(1970;1;1))*86400000)+VALUE(MID(A1;FIND(".";A1)+1;3))
# Multithreading in Python using the `threading` module.
# Based on: https://www.toptal.com/python/beginners-guide-to-concurrency-and-parallelism-in-python
import logging
import time
import random
from queue import Queue
from threading import Thread
@edonosotti
edonosotti / chatbase-howto.py
Last active December 15, 2020 10:22
How to integrate Chatbase in a Python project.
# Integrating Chatbase in your chatbot - Python version
#
# The purpose of this code is to show how to integrate the Chatbase service in any chatbot.
#
# See my article on Chatbots Magazine for details:
# https://chatbotsmagazine.com/advanced-chatbot-analytics-and-sentiment-analysis-part-1-17a8e674d7e1
#
# License: MIT (https://opensource.org/licenses/MIT) (C) Edoardo Nosotti, 2017
from chatbase import Message, MessageSet, MessageTypes, InvalidMessageTypeError
@edonosotti
edonosotti / chatbase-howto.js
Last active April 26, 2024 10:51
How to integrate chatbase in a chatbot project.
# Integrating Chatbase in your chatbot - Node.JS version
#
# The purpose of this code is to show how to integrate the Chatbase service in any chatbot.
#
# See my article on Chatbots Magazine for details:
# https://chatbotsmagazine.com/advanced-chatbot-analytics-and-sentiment-analysis-part-1-17a8e674d7e1
#
# License: MIT (https://opensource.org/licenses/MIT) (C) Edoardo Nosotti, 2017
const chatbase = require('@google/chatbase');
@edonosotti
edonosotti / silly-echo-bot-ruby-wechat.rb
Last active December 18, 2017 13:18
The purpose of this code is to show the basics of creating chatbots for the WeChat (and Weixin) platform using the Ruby language. It creates a simple backend that echoes back the messages it receives from users.
# The Silly Echo Bot for WeChat - Ruby version
#
# The purpose of this code is to show the basics of creating chatbots for the WeChat platform.
# It creates a simple backend that echoes back the messages it receives from users.
#
# See my article on Chatbots Magazine for details:
# https://chatbotsmagazine.com/building-chatbots-for-wechat-part-1-dba8f160349
#
# Tested with:
# Ruby 2.2.3
@edonosotti
edonosotti / silly-echo-bot-python-wechat.py
Last active September 25, 2023 14:04
The purpose of this code is to show the basics of creating chatbots for for the WeChat (and Weixin) platform using the Python language. It creates a simple backend that echoes back the messages it receives from users.
# The Silly Echo Bot for WeChat - Python version
#
# The purpose of this code is to show the basics of creating chatbots for the WeChat platform.
# It creates a simple backend that echoes back the messages it receives from users.
#
# See my article on Chatbots Magazine for details:
# https://chatbotsmagazine.com/building-chatbots-for-wechat-part-1-dba8f160349
#
# Tested with:
# Python 3.5.2