Skip to content

Instantly share code, notes, and snippets.

@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');
@hadware
hadware / bytes_to_wav.py
Last active April 26, 2024 10:50
Convert wav in bytes for to numpy ndarray, then back to bytes
from scipy.io.wavfile import read, write
import io
## This may look a bit intricate/useless, considering the fact that scipy's read() and write() function already return a
## numpy ndarray, but the BytesIO "hack" may be useful in case you get the wav not through a file, but trough some websocket or
## HTTP Post request. This should obviously work with any other sound format, as long as you have the proper decoding function
with open("input_wav.wav", "rb") as wavfile:
input_wav = wavfile.read()

ZSH CheatSheet

This is a cheat sheet for how to perform various actions to ZSH, which can be tricky to find on the web as the syntax is not intuitive and it is generally not very well-documented.

Strings

Description Syntax
Get the length of a string ${#VARNAME}
Get a single character ${VARNAME[index]}
[
{
"id": "c154697af277016d452b1bc815f5d1787fa2d694",
"thumbnail": "https://media.guim.co.uk/9fd1d41b23d3831ee8b918930cdd1bdc0c8045e1/0_0_2560_1536/500.jpg",
"title": "There is a wounded pigeon in the garden. Should I intervene?",
"url": "https://www.theguardian.com/lifeandstyle/2022/oct/15/there-is-a-wounded-pigeon-in-the-garden-should-i-intervene",
"words": "795",
"section": "Life and style",
"date": "2022-10-15T05:00:58Z",
"image": "https://media.guim.co.uk/9fd1d41b23d3831ee8b918930cdd1bdc0c8045e1/0_0_2560_1536/1000.jpg",
@stephenhandley
stephenhandley / exportQueue.js
Last active April 26, 2024 10:46
Rdio queue to json
var queue = [];
var $albums = $('.QueueList .Album');
for (var i = 0; i < $albums.length; i++) {
var $album = $($albums[i]);
var $title = $album.find('.album_title');
var $artist = $album.find('.artist_title');
queue.push({
title : $title.text(),
href : $title.attr('href'),
artist : $artist.text()
@oclockvn
oclockvn / dictionary.js
Created January 25, 2018 20:54
find a word contains letter
var source = ["the",
"of",
"and",
"to",
"a",
"in",
"for",
"is",
"on",
"that",
@aymericbeaumet
aymericbeaumet / delete-likes-from-twitter.md
Last active April 26, 2024 10:45
[Recipe] Delete all your likes/favorites from Twitter

Ever wanted to delete all your likes/favorites from Twitter but only found broken/expensive tools? You are in the right place.

  1. Go to: https://twitter.com/{username}/likes
  2. Open the console and run the following JavaScript code:
setInterval(() => {
  for (const d of document.querySelectorAll('div[data-testid="unlike"]')) {
    d.click()
 }
// Curious about ages for the 2019 tour divide.
// Text grabbed from https://bikepacking.com/bikes/tour-divide-rigs-2019/
// That website is the best, I didn't write any of this, they did, all credit to them.
// btw:
// average age: 44.782051282051285
// median age: 45
const originalStr = `
JOIN/SUPPORT
@digitaljhelms
digitaljhelms / gist:4287848
Last active April 26, 2024 10:44
Git/GitHub branching standards & conventions

Branching

Quick Legend

Description, Instructions, Notes
Instance Branch
@jaawerth
jaawerth / desc.md
Last active April 26, 2024 10:44
No Fun Tuesdays (replace En Eff Tee with random dictionary words)

Non-Funkadelic Toasters userscript

Because sometimes I don't want to see the word "Necromancy's Fiscal Tecumseh's."

Nonintervention Feline Targets-replacer

Not properly documenting this, but if you wanna use it...

I may or may not eventually get around to properly packaging this as a shareable userscript or extension, complete with preloaded replacement words and such, so to use it: