Skip to content

Instantly share code, notes, and snippets.

@dukedougal
dukedougal / gist:9edb1e4fd525271c57c0
Created November 8, 2015 02:37
Simple restify-nedb example not working
var morgan = require('morgan')
var compression = require('compression')
var express = require('express');
var methodOverride = require('method-override')
var bodyParser = require('body-parser')
var app = express();
app.set('port', 1337);
app.use(compression());
PS C:\Users\username\devel\rubix> npm install
npm WARN deprecated gulp-uglifyjs@0.5.0: Since gulp-sourcemaps now works, use gulp-uglify instead
npm WARN deprecated gulp-webpack@1.5.0: Renamed to https://www.npmjs.com/package/webpack-stream
npm WARN deprecated react-hot-loader@0.5.0: React Hot Loader 1.1 has been released with support for next versions of React and ES6 classes. See https://github.com/gaearon/react-hot-loader/blob/master/docs/README.md#migrating-to-10
npm WARN deprecated CSSselect@0.4.1: the module is now available as 'css-select'
npm WARN deprecated CSSwhat@0.4.7: the module is now available as 'css-what'
npm WARN install Couldn't install optional dependency: Unsupported
npm WARN prefer global marked@0.3.5 should be installed with -g
npm WARN prefer global js-beautify@1.5.10 should be installed with -g
@dukedougal
dukedougal / gist:fd0ba9b6f1593ed7ca06
Created September 21, 2015 13:49
Create msdos bootable ext4
root@ip-10-0-0-249:/home/ubuntu# fdisk /dev/xvdf
Device contains neither a valid DOS partition table, nor Sun, SGI or OSF disklabel
Building a new DOS disklabel with disk identifier 0x548c70c6.
Changes will remain in memory only, until you decide to write them.
After that, of course, the previous content won't be recoverable.
Warning: invalid flag 0x0000 of partition table 4 will be corrected by w(rite)
Command (m for help): m
Command action
@dukedougal
dukedougal / gist:9a9b24e7b74586a9ddac
Last active August 29, 2015 14:21
Build Haskell on Ubuntu
sudo apt-get install software-properties-common
sudo add-apt-repository -y ppa:hvr/ghc
sudo apt-get update
# if EC2 ubuntu instance, add swap
sudo /bin/dd if=/dev/zero of=/var/swap.1 bs=1M count=1024
sudo /sbin/mkswap /var/swap.1
sudo /sbin/swapon /var/swap.1
sudo apt-get install -y libncurses5-dev libtool libxen-dev software-properties-common cabal-install-1.20 ghc-7.8.4 zlib1g-dev autoconf git build-essential curl
pdfinfo http://linux.about.com/library/cmd/blcmdl1_pdfinfo.htm
pdfjoin
pdfcrop
pdfcrop2 http://code.google.com/p/pdfcrop2/wiki/Usage
Crop with PyPDF
http://code.activestate.com/recipes/576837-crop-pdf-file-with-pypdf/
Cropping
To crop a PDF with PDFCrop:
@dukedougal
dukedougal / extractattachments
Last active August 31, 2022 09:03
Python 3.4 extract attachments from email
#!python3.4
import io
import os
import sys
import mimetypes
import uuid
# Import the email modules we'll need
from email import policy
from email.parser import BytesParser