Skip to content

Instantly share code, notes, and snippets.

@tyndyll
tyndyll / extract.py
Created January 23, 2015 18:49
Parsing Maildir Mail Stored on Disk with Python
def unicode_it(data):
# Take a string of data and convert it to unicode
try:
return unicode(data, errors="replace").strip()
except TypeError as E:
return u""
def extract(msg, msg_obj, attachments):
if msg.is_multipart():
for part in msg.get_payload():
@tyndyll
tyndyll / bashpipe.go
Last active July 14, 2023 17:39
Execute Piped Shell Commands in Go
package main
import (
"bytes"
"io"
"log"
"os"
"os/exec"
)
@tyndyll
tyndyll / README.md
Last active November 4, 2021 05:54
Download Podcast from Overcast Permalinks

Download From Overcast

Overcast on iOS is my primary podcasting listening method, but I have an occasional need to download podcasts for archival or offline listening purposes. This script takes advantage of Overcast's permalink and showpage to get the podcast author and title before downloading the podcast itself from the original page.

Usage: python download_from_overcast.py 
@tyndyll
tyndyll / Filament Holder for 3D Printers for Laser Cutting.md
Last active July 12, 2021 10:05
Filament Holder for 3D Printers for Laser Cutting

I had a whoopsie and broke the supplied filament holder for my Anycubic 3D printer. Rather than spending the money I took advantage of my Farset Labs membership and some scrap MDF I had lying around. The design was created to use materials 6mm thick. You will require 2 of each SVG

If you want the original model it is available at Tinkercad

NOTE: A support for the filament itself is not included. I just use a pencil

@tyndyll
tyndyll / strip-url-trackers.py
Last active May 16, 2021 06:59
Strip UTM parameters from a URL
#!/usr/bin/env python
#
# Copyright 2018 Tyndyll
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to
# deal in the Software without restriction, including without limitation the
# rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
# sell copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
#/bin/bash
#
# https://twitter.com/samykamkar/status/1011166802880020482
# Sniff network traffic from your iOS device, no jailbreak necessary! Just plug into your mac and run:
system_profiler SPUSBDataType|perl -0 -ne'/iP(?:hone|ad):.*?Serial Number: (\S+)/s?`rvictl -s $1`:0' ; sudo tcpdump -i rvi0 # standard tcpdump options/filters apply
@tyndyll
tyndyll / test_urls.py
Created February 20, 2020 14:17
Test Django URL Resolves to Correct CBV
from django.test import TestCase
from django.urls import resolve
from .views import Home
class TestURLPatterns(TestCase):
def test_home_path_calls_home_view(self):
found = resolve("/")
self.assertEqual(found.func.view_class, Home)
@tyndyll
tyndyll / README.md
Created April 23, 2019 17:00
English Premier League Table Viewer

English Premier League Table Viewer

Abstract

This is a simple implementation of a problem presented in a conversation that arose about hiring questions that I was nerdsniped on. This is just a basic textual output instead of the requested HTML output, but that could have been implemented using html/template instead of text/template.

Problem Definition

The English Premier League is the top-tier league of soccer (football) teams, which consists of 20 teams. Every year, each team in the league play 38 matches (2 matches against every other team).

@tyndyll
tyndyll / README.md
Last active February 26, 2019 12:44
Introduction to Go - Hello World Server

Hello World

This gist is the code portion of a talk given at the Crystal Ball Bash.

The talk was a very high level introduction to go, and the code here is a commented example of the syntax and features that Go has to offer. It is a Hello World example, but with the twist of being a HTTP server, that uses concurrency to print out to the terminal. It looks long, but it amounts to about 50 lines of actual code once you remove the comments

Running

It is assumed that you have previously downloaded and installed Go, and configured it appropriately

Clone this gist or simply download the hello_world.go file. We are not importing any external packages so it doesn't necessarily have to exist inside the GOPATH.

@tyndyll
tyndyll / keybase.md
Last active April 18, 2018 20:25
keybase.md

Keybase proof

I hereby claim:

  • I am tyndyll on github.
  • I am tyndyll (https://keybase.io/tyndyll) on keybase.
  • I have a public key ASAD9vtg2PNFnl-C7IE2qUlHfWLJne1sz5m9YsRgiwes2go

To claim this, I am signing this object: