Skip to content

Instantly share code, notes, and snippets.

Keybase proof

I hereby claim:

  • I am delputnam on github.
  • I am delputnam (https://keybase.io/delputnam) on keybase.
  • I have a public key whose fingerprint is 0BF0 8C2E 24F4 9CA1 11AC C4D7 D2DD BB94 503E E5F0

To claim this, I am signing this object:

sudo lsof -i
sudo netstat -lptu
sudo netstat -tulpn
@delputnam
delputnam / file_check.go
Created February 23, 2016 21:01
Check for existence of file using golang
if _, err := os.Stat("/path/to/file/or/dir"); os.IsNotExist(err) {
// /path/to/file/or/dir does not exist
}
if _, err := os.Stat("/path/to/file/or/dir"); err == nil {
// /path/to/file/or/dir exists
}
# Tailored for default debian host on Google Cloud Compute,
# but should work for most Ubuntu/Debian systems.
# Be sure to replace 'example.com' with your URL.
# install zip, vim and wget
sudo apt-get update
sudo apt-get upgrade -y
sudo apt-get install -y zip vim wget
# install nodejs 0.10.xx
@delputnam
delputnam / gist:6c88a99fb408b0c67b70
Created December 4, 2015 21:28
Show/Hide files in OS X Finder
# Show all files
defaults write com.apple.finder AppleShowAllFiles YES
# Don't show hidden files
defaults write com.apple.finder AppleShowAllFiles NO
@delputnam
delputnam / gist:63dc8234df5841bad924
Created November 17, 2015 23:02 — forked from pitch-gist/gist:2999707
HTML: Simple Maintenance Page
<!doctype html>
<title>Site Maintenance</title>
<style>
body { text-align: center; padding: 150px; }
h1 { font-size: 50px; }
body { font: 20px Helvetica, sans-serif; color: #333; }
article { display: block; text-align: left; width: 650px; margin: 0 auto; }
a { color: #dc8100; text-decoration: none; }
a:hover { color: #333; text-decoration: none; }
</style>
@delputnam
delputnam / gist:71b11fb750310f3e57b3
Last active August 29, 2015 14:16
Set up postfix (on Mac OS X 10.10 Yosemite) with Google Apps smtp
$ sudo vim /etc/postfix/main.cf
Add the following to the 'relayhost' section:
relayhost = [smtp.gmail.com]:587
smtp_sasl_auth_enable = yes
smtp_sasl_password_maps = hash:/etc/postfix/sasl_passwd
smtp_sasl_security_options = noanonymous
smtp_use_tls = yes
smtp_sasl_mechanism_filter = plain
@delputnam
delputnam / gist:3ef2dbede54491b2bbf8
Created March 8, 2015 01:26
Set up ssh without password
ssh-keygen -t rsa
ssh username@remotehost mkdir -p .ssh
cat ~/.ssh/id_rsa.pub | ssh username@remothost 'cat >> .ssh/authorized_keys'
@delputnam
delputnam / gist:68484d0c3f59a6670bb6
Created January 5, 2015 14:00
Embed video in HTML email
<!doctype html>
<!-- For more info: http://www.emailonacid.com/blog/details/C13/a_how_to_guide_to_embedding_html5_video_in_email -->
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>Video in Email Test</title>
<style type="text/css">
@media screen and (max-width:800px) {
@delputnam
delputnam / gist:b44118c7974cd0b6643d
Created January 5, 2015 13:59
Send an HTML email from the command line
You can do this relatively simple from the command line. Save your HTML, but also include the necessary SMTP headers at the top in the source. For this example I'll save the source as example.html in my home directory.
~/example.html:
From: sender@example.com
To: recipient@example.com
Subject: Test email
Mime-Version: 1.0
Content-Type: text/html