Skip to content

Instantly share code, notes, and snippets.

@rsudip90
rsudip90 / extract-attachments.py
Created October 4, 2018 17:13 — forked from stefansundin/extract-attachments.py
Extract attachments from emails that Gmail doesn't allow you to download. This is dumb. Please use Python >= 3.4.
#!/usr/bin/env python3
# Get your files that Gmail block. Warning message:
# "Anti-virus warning - 1 attachment contains a virus or blocked file. Downloading this attachment is disabled."
# Based on: https://spapas.github.io/2014/10/23/retrieve-gmail-blocked-attachments/
# Instructions:
# Go to your emails, click the arrow button in the top right, "Show original", then "Download Original".
# Move the files to the same directory as this program, then run it.
import email
@rsudip90
rsudip90 / translate.go
Created February 8, 2018 12:15 — forked from hvoecking/translate.go
Golang reflection: traversing arbitrary structures
// Traverses an arbitrary struct and translates all stings it encounters
//
// I haven't seen an example for reflection traversing an arbitrary struct, so
// I want to share this with you. If you encounter any bugs or want to see
// another example please comment.
//
// The MIT License (MIT)
//
// Copyright (c) 2014 Heye Vöcking
//
package main
import (
"net/http"
)
type SingleHost struct {
handler http.Handler
allowedHost string
}
package main
import (
"fmt"
)
func decorator(f func(s string)) func(s string) {
return func(s string) {
fmt.Println("Started")
@rsudip90
rsudip90 / valuer.go
Created November 23, 2017 13:23 — forked from jmoiron/valuer.go
Example uses of sql.Scanner and driver.Valuer
package main
import (
"bytes"
"compress/gzip"
"database/sql/driver"
"errors"
"fmt"
"github.com/jmoiron/sqlx"
_ "github.com/mattn/go-sqlite3"
@rsudip90
rsudip90 / main.go
Created August 10, 2017 17:26 — forked from kevburnsjr/main.go
Easy Middleware in Go
package main
import (
"net/http"
"time"
"log"
)
func main() {
dh := DispatchHandler{}