Skip to content

Instantly share code, notes, and snippets.

@vcidst
vcidst / confirmEmail.gs
Last active April 7, 2017 08:35
Send confirmation emails to people with Google Forms
/******************************
Code.gs
by vcidst
Add this to your spreadsheet that is linked to the form.
You can add this by going to Tools > Script Editor.
Edit accordingly. Everything in between the quotes is regular HTML.
@vcidst
vcidst / quotesOnCurses.py
Last active December 9, 2017 07:52
Structure of a curses application by [Sean Zicari](https://www.youtube.com/watch?v=eN1eZtjLEnU)
# This gist is transcribed from a talk by Sean Zicari
# Talk: Use Curses, don't swear https://www.youtube.com/watch?v=eN1eZtjLEnU
#
# I haven't written the function which he used to fetch quotes from the web
# This only presents the barebones structure of his application
#
# If debugging a curses application messes up your terminal, type `tset` to reset terminal
import curses
@vcidst
vcidst / sdp-h1.pcap
Created December 2, 2017 08:39
Partial USB Dump of AD SDP-H1
1 0x00000000 0 $print instruction Direction "Down" 02.12.2017 02:58:33
1 0x00000000 640 URB urb {…} 02.12.2017 02:58:33
1 0x00000000 24 URB_HEADER UrbHeader {…} 02.12.2017 02:58:33
1 0x00000000 2 unsigned short Length 128 02.12.2017 02:58:33
1 0x00000002 2 URB_FUNCTION Function URB_FUNCTION_BULK_OR_INTERRUPT_TRANSFER (9) 02.12.2017 02:58:33
1 0x00000004 4 USBD_STATUS Status { Status=SUCCESS (0); Type="Success" } 02.12.2017 02:58:33
1 0x00000004 4 StatusCode Status SUCCESS (0) 02.12.2017 02:58:33
1 0x00000008 0 $print instruction Type "Success" 02.12.2017 02:58:33
1 0x00000008 8 unsigned __int64 UsbdDeviceHandle 0 02.12.2017 02:58:33
@vcidst
vcidst / OverlappedGrab.cs
Created January 8, 2018 10:55
Basler PylonC.NET Sample, Overlapped Grab
/*
This sample illustrates how to grab images and process images asynchronously, i.e.,
while the application is processing a buffer, the acquistion of the next buffer is done
in parallel.
The sample uses a pool of buffers that are passed to a stream grabber to be filled with
image data. Once a buffer is filled and ready for processing, the buffer is retrieved from
the stream grabber, processed, and passed back to the stream grabber to be filled again.
Buffers retrieved from the stream grabber are not overwritten in the background as long as
they are not passed back to the stream grabber.
*/
@vcidst
vcidst / bot.js
Last active June 24, 2018 11:37
Source for bombayraincalls // twitter bot that tweets if it is raining in Bombay // https://twitter.com/bombayraincalls
// @bombayraincalls
// https://twitter.com/bombayraincalls
// tweets when it is raining in bombay
// generously supported by /r/Mumbai
// original source by dariusk
// https://github.com/dariusk/examplebot
// Our Twitter library
var Twit = require('twit');
@vcidst
vcidst / prepositions.py
Last active May 31, 2020 10:52
Creates a dictionary object with the 3 most common prepositions for every verb in the NLTK Brown Corpus. Export ConditionalFrequencyDist Object as a JSON
import nltk
from nltk.corpus import brown
import json
prepchoices = nltk.ConditionalFreqDist((v[0], p[0])
for (v, p) in nltk.bigrams(brown.tagged_words(tagset="universal"))
if v[1] == "VERB" and p[1] == "ADP")
pc = dict()
for word in prepchoices.conditions():
@vcidst
vcidst / bot.js
Created June 10, 2020 04:48
Bombay Rain Calls - A twitter bot for Mumbai Rain Alerts
// Our Twitter library
var Twit = require('twit');
var weather = require('weather-js');
// We need to include our configuration file
var T = new Twit(require('./config.js'));
// this function posts to twitter that it is rainy
function rainTwitter(today) {
var tweets = [
@vcidst
vcidst / milvus-data-upload.py
Created November 2, 2023 09:03
Extract documents from a folder and create a Milvus collection. Requires the pymilvus package. Make sure that you have the OPENAI_API_KEY environment variable set
# Usage: python data-upload.py --docs_folder data/documents
import logging
from langchain.embeddings.openai import OpenAIEmbeddings
from langchain.text_splitter import RecursiveCharacterTextSplitter
from langchain.vectorstores import Milvus
from langchain.document_loaders import DirectoryLoader, TextLoader
from pathlib import Path
from langchain.schema import Document
from typing import List
@vcidst
vcidst / Enterprise Search debug.md
Created July 9, 2024 13:02
Enterprise Search Debugging for Rasa Pro 3.8+
graph TD
A[Start] --> B[Are debug logs enabled?]
B -- No --> C[Enable debug logs and restart]
B -- Yes --> D["If the assistant uses LLM Router,
was the appropriate command predicted?"]
D -- No --> E[Look into LLM Router configuration]
D -- Yes --> F["Did command generator
trigger SearchAndReply command?"]
F -- No --> G["Look into modifying