Skip to content

Instantly share code, notes, and snippets.

View shivkanthb's full-sized avatar
🧃
sippin' n shippin'

Shivkanth Bagavathy shivkanthb

🧃
sippin' n shippin'
View GitHub Profile
@shivkanthb
shivkanthb / main.py
Created April 3, 2023 22:05
callboxbot
from flask import Flask, request, Response
from twilio.twiml.voice_response import VoiceResponse, Gather
from twilio.rest import Client
import os
app = Flask(__name__)
account_sid = os.environ['ACCOUNT_SID']
auth_token = os.environ['AUTH_TOKEN']
twilio_phone_number = os.environ['PHONE_NUMBER']
@shivkanthb
shivkanthb / app-widget.js
Last active March 5, 2024 12:54
Eth gas prices - Scriptable
"use strict";
async function getGasPrices() {
const url = "https://ethgasstation.info/api/ethgasAPI.json?api-key=blahblah";
// Initialize new request
const request = new Request(url);
// Execute the request and parse the response as json
const response = await request.loadJSON();
return response;
}
@shivkanthb
shivkanthb / classify_startstop.py
Created March 29, 2017 06:08
Subscribe and unsubscribe to messages
from textblob.classifiers import NaiveBayesClassifier
from textblob import TextBlob
train = [
('Take me off', 'stop'),
('Stop texting','stop'),
('stop messaging','stop'),
('Don\'t talk', 'stop'),
('Stop messaging','stop'),
('dont want to talk anymore','stop'),
@shivkanthb
shivkanthb / removeFormatting.js
Created January 25, 2017 02:47
Remove the slack formatting on URL's, email addresses, channels, groups and user ids.
function removeSlackFormatting(input)
{
var text = input;
text = text.replace(/<([@#!])?([^>|]+)(?:\|([^>]+))?>/g, (function(_this) {
return function(m, type, link, label) {
var channel, user;
switch (type) {
case '@':
if (label) {
return label;
import requests
import json
google_key = 'AIzaSyA-inA65SCHf-kT04GubUvTwCeGmPwikyQ'
base_url = 'https://www.googleapis.com/language/translate/v2'
# translates input to target_lang
def translate(input, target_lang='en'):
payload = {'q' : input, 'target' : target_lang, 'key' : google_key}
r = requests.get(base_url, params=payload)
@shivkanthb
shivkanthb / README.md
Created May 5, 2016 11:45 — forked from jxson/README.md
README.md template

Synopsis

At the top of the file there should be a short introduction and/ or overview that explains what the project is. This description should match descriptions added for package managers (Gemspec, package.json, etc.)

Code Example

Show what the library does as concisely as possible, developers should be able to figure out how your project solves their problem by looking at the code example. Make sure the API you are showing off is obvious, and that your code is short and concise.

Motivation