Skip to content

Instantly share code, notes, and snippets.

View byteofprash's full-sized avatar

Prashanth Swaminathan byteofprash

View GitHub Profile
@byteofprash
byteofprash / process.js
Last active July 22, 2022 13:37
Async Twilio Studio and serverless
const axios = require('axios');
// This is your new function. To start, set the name and path on the left.
exports.handler = async function(context, event, callback) {
// Here's an example of setting up some TWiML to respond to with this function
const twiml = `
<?xml version="1.0" encoding="UTF-8"?>
<Response>
<Play>http://com.twilio.sounds.music.s3.amazonaws.com/ClockworkWaltz.mp3</Play>
import os
from flask import Flask, request, abort
from twilio.request_validator import RequestValidator
from urllib import parse
from collections import OrderedDict
from hashlib import sha1, sha256
import hmac
import base64
app = Flask(__name__)
@byteofprash
byteofprash / ROS-Melodic-Python3
Last active February 26, 2020 15:27
Steps to install ROS with python3.
# Warning: don't try to run this as a script. It probably won't work.
# remove all things python (optional)
sudo apt-get remove python-*
# remove previous installations of ROS
sudo apt-get remove ros-*
sudo apt-get remove ros-melodic-*
sudo apt-get autoremove

Grep

  1. To use a Color GREP to only highlight matched patterns but not otherwise change the output:

grep --color=always -e "^" -e "hello" testfile

  1. Find a pattern in all files
    grep -rnw '/path/to/somewhere/' -e 'pattern' 
    * -r or -R is recursive,
    * -n is line number, and
@byteofprash
byteofprash / unix_philosophy.md
Created January 22, 2020 13:31
Unix Philosophy summarized by ESR

Unix philosophy

  1. Rule of Modularity: Write simple parts connected by clean interfaces.
  2. Rule of Clarity: Clarity is better than cleverness.
  3. Rule of Composition: Design programs to be connected to other programs.
  4. Rule of Separation: Separate policy from mechanism; separate interfaces from engines.
  5. Rule of Simplicity: Design for simplicity; add complexity only where you must.
  6. Rule of Parsimony: Write a big program only when it is clear by demonstration that nothing else will do.
  7. Rule of Transparency: Design for visibility to make inspection and debugging easier.
  8. Rule of Robustness: Robustness is the child of transparency and simplicity.
  9. Rule of Representation: Fold knowledge into data so program logic can be stupid and robust.

Keybase proof

I hereby claim:

  • I am byteofprash on github.
  • I am byteofprash (https://keybase.io/byteofprash) on keybase.
  • I have a public key ASCZxPFm-vA33lpYYoV4fFCZAVPVQvtUaOhD5xo2VvpJJgo

To claim this, I am signing this object:

@byteofprash
byteofprash / cities_latlong.sparql
Created February 27, 2018 10:29
A spraql query to get the lat long of certain cities
## Sparql Query to get the lat long of certain cities
SELECT DISTINCT ?countryLabel ?label ?lat ?long WHERE {
{?city rdf:type dbo:City} UNION {?city rdf:type dbo:PopulatedPlace}
?city rdfs:label ?label ;
geo:lat ?lat ;
geo:long ?long ;
dbo:country ?country ;
rdfs:label ?name .