Skip to content

Instantly share code, notes, and snippets.

View Cartmanishere's full-sized avatar
💻

Pranav Gajjewar Cartmanishere

💻
View GitHub Profile
<h1>
{{#if username}}
Welcome {{username}}!
{{else}}
Welcome user!
{{/if}}
</h1>
@Cartmanishere
Cartmanishere / email.html
Last active July 11, 2021 06:00
HTML template for Automating emails in Google Sheets blog post
<!DOCTYPE HTML PUBLIC "-//W3C//DTD XHTML 1.0 Transitional //EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office">
<head>
<!--[if gte mso 9]>
<xml>
<o:OfficeDocumentSettings>
<o:AllowPNG/>
<o:PixelsPerInch>96</o:PixelsPerInch>
</o:OfficeDocumentSettings>
</xml>
@Cartmanishere
Cartmanishere / email.js
Last active July 11, 2021 09:06
Email sending example using rendered HTML in appscript
function renderEmail(context) {
var template = HtmlService.createTemplateFromFile("emailTemplate");
template.context = context;
return template.evaluate().getContent();
}
function sendEmail(order) {
var context = {
message: "Your order has been accepted! Please find the details as follow:",
customerName: order[1],
(ns ...
(:import [com.github.jknack.handlebars.io TemplateLoader URLTemplateSource]
[java.net URL]))
(defn http-loader-reify
[base-url]
(reify TemplateLoader
(resolve [this filename]
(str base-url filename (. this getSuffix)))
(ns clj-handlebars.http-loader
(:gen-class
:init init
:state state
:name com.github.jknack.handlebars.io.HTTPCljLoader
:implements [com.github.jknack.handlebars.io.TemplateLoader]
:constructors {[String] []}
:prefix "-")
(:import [com.github.jknack.handlebars.io URLTemplateSource]
[java.net URL]))
@Cartmanishere
Cartmanishere / torrent-verify.py
Created September 13, 2021 01:42
A python script to verify hash of torrent downloaded files
# This code is taken from: https://stackoverflow.com/a/2573715
# Use python 2.7
# Install Bencode package: https://pypi.org/project/BitTorrent-bencode/5.0.8/#files
# Usage: python torrent-verify.py <torrent-file>
import sys
import os
import hashlib
import bencode
import StringIO