Skip to content

Instantly share code, notes, and snippets.

import mailbox
def extract_from(mbox_file):
mbox = mailbox.mbox(mbox_file)
for message in mbox:
print(message['from'])
if __name__ == "__main__":
import sys
#!/bin/bash
# create a RAMDISK like so `create-ram-disk 6` to create a 6Gb ramdisk.
# diagnostic information is written to STDERR: the name of the newly-created disk is written to STDOUT
# from https://stackoverflow.com/a/47354885/6722
set -e
FILEPATH="${BASH_SOURCE[0]}"
FILE=$(basename "${FILEPATH}")
DIR="$(cd "$(dirname "${FILEPATH}")" && pwd)"
@stevecooperorg
stevecooperorg / Compressor.cs
Created February 20, 2017 23:49
Compressor.cs -- resize a bitmap to within 5% of a target size
using System;
using System.Collections.Generic;
using System.Drawing; // include System.Drawing.dll
using System.Drawing.Drawing2D;
using System.Drawing.Imaging;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
@stevecooperorg
stevecooperorg / gulpfile.js
Last active January 20, 2017 21:52
A simple gulp file which lints and runs jasmine tests
/*
cd ~/IdeaProects/foo
rm package.json
rm -rf node_modules
npm init -y
npm install gulp --save-dev
npm install jshint --save-dev
npm install gulp-jshint --save-dev
npm install gulp-watch --save-dev
npm install jasmine --save-dev
@stevecooperorg
stevecooperorg / Program.cs
Created December 16, 2014 15:07
Lesson 3 - objects and classes
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace HelloPerson
{
class Program
{
@stevecooperorg
stevecooperorg / Program.cs
Created December 2, 2014 14:12
Lesson 2 - functions and enums
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace HelloPerson
{
@stevecooperorg
stevecooperorg / Program.cs
Created November 20, 2014 13:23
C# lesson 1a
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace HelloPerson
{
class Program
{
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace HelloStuff
{
class Program
{
@stevecooperorg
stevecooperorg / ReplaceTabsWithParagraphs.vba
Created October 30, 2014 21:37
ReplaceTabsWithParagraphs VBA macro
Sub ReplaceTabsWithParagraphs()
Selection.Find.ClearFormatting
Selection.Find.Replacement.ClearFormatting
With Selection.Find
.Text = "^t"
.Replacement.Text = "^v"
.Forward = True
.Wrap = wdFindContinue
.Format = False
.MatchCase = False
@stevecooperorg
stevecooperorg / Program.cs
Created October 29, 2014 15:35
Blinky lights for the build yak (2014-10-29 15:34)
// uses .Net Micro Framework 4.2, runs on Netduino 2 Plus.
using System;
using System.Net;
using System.Net.Sockets;
using System.Threading;
using Microsoft.SPOT;
using Microsoft.SPOT.Hardware;
using SecretLabs.NETMF.Hardware;
using SecretLabs.NETMF.Hardware.Netduino;