Skip to content

Instantly share code, notes, and snippets.

View etowett's full-sized avatar

Eutychus Towett etowett

View GitHub Profile
@etowett
etowett / httpreq.py
Created November 8, 2016 09:46
These two files demonstrate how to send SMSes using AfricasTalking API (https://africastalking.com/) in an asynchronous way.
#!/usr/bin/python2.7
import urllib
from twisted.internet import protocol
from twisted.internet import defer
from twisted.web.http_headers import Headers
from twisted.internet import reactor
from twisted.web.client import Agent
from twisted.web.iweb import IBodyProducer
from zope.interface import implements
@etowett
etowett / letsencrpt.sh
Last active July 3, 2017 14:29
Commands to create letsencrypt certs and autorenew when they expire
# Clone letsenrypt to /opt
sudo git clone https://github.com/letsencrypt/letsencrypt /opt/letsencrypt
# To Create Certs
sudo -H /opt/letsencrypt/letsencrypt-auto certonly --standalone -d site.com -d www.site.com
# To Renew
sudo -H /opt/letsencrypt/letsencrypt-auto certonly --standalone --renew-by-default -d site.com -d www.site.com
# To Autorenew
-----------------------------------------------
/etc/systemd/system/renew-letsencrypt.service :
-----------------------------------------------
[Unit]
Description=Renew Let's Encrypt certificates
[Service]
Type=oneshot
# check for renewal, only start/stop nginx if certs need to be renewed
@etowett
etowett / convert_video_to_mp3.go
Last active November 16, 2017 09:35
Convert video files (single or in a folder) to mp3
package main
import (
"flag"
"fmt"
"io/ioutil"
"os"
"os/exec"
"strings"
)
package main
import (
"flag"
"fmt"
"io/ioutil"
"os"
"os/exec"
"strings"
)
@etowett
etowett / ses-email-process.go
Created June 29, 2020 08:16
Lambda function to get email from SES and extract attachment to s3
package main
import (
"bytes"
"encoding/json"
"fmt"
"io"
"log"
"os"
"path"