Skip to content

Instantly share code, notes, and snippets.

### Keybase proof
I hereby claim:
* I am charsi on github.
* I am charsi ( on keybase.
* I have a public key whose fingerprint is 09DA 5C6E 6470 B35C EFF2 8CDB C370 01FC A19E A978
To claim this, I am signing this object:
// Code describing how Diffie-Hellman key exchange works. Suprisingly simple to understand.
// This does not work because Javascript can't deal with large numbers.
let g = 5;
let n = 37;
let pvtA = 5;
let pvtB = 8;
charsi / Twilio-function-SMS-email-forward.js
Created January 10, 2018 12:07
Twilio function for forwarding text messages to email using mailgun.
let toEmail = 'TO EMAIL ADDRESS';
let fromEmail = 'FROM EMAIl ADDRESS';
exports.handler = function(context, event, callback) {
//var mailgun = require('mailgun-js')({apiKey: context.MG_KEY, domain: context.MG_DOMAIN});
var domain = fromEmail.split('@')[1];
var mailgun = require('mailgun-js')({apiKey: mgKey, domain: domain});
var number = event.From;
charsi / Twilio-function-SRV-forward.js
Last active January 10, 2021 02:40
Twilio function to forward calls to a SIP host that uses SRV (RFC 3263) records for load balancing. Twilio doesn't natively support SRV for looking up SIP servers. So, calls made to most SIP hosts result in a DNS failure. This script is a workaround for that issue.
const dns = require('dns');
let sipUri = ''; // Any sip uri using srv records should work
let protocol = 'udp';
let region = 'us2' ;
exports.handler = function(context, event, callback) {
var user = sipUri.split('@')[0];
var host = sipUri.split('@')[1];
charsi /
Last active October 20, 2020 08:02
shell script for monitoring WAN staus on router and sending pushover notifications
# This script checks for internet connectivity on your wan port and sends a pushover message if there has been a change.
# Multiple WAN ports supported.
# Based on Scripts from Wob_76 & WaLLy3K at
# Set the Number of WANS (Valid Numbes 1 to 4)
# Name your ISPs
charsi /
Last active December 8, 2015 05:57
Gets a list of working hot-linkable URLs to images of puppies!
# Fetches random puppy images and save sthem to images.txt
# Useful for populating dummy data
import urllib
import json
import requests
numberOfImages = 141
validateUrls = True # slows script execution