Skip to content

Instantly share code, notes, and snippets.

View johnantoni's full-sized avatar

John Griffiths johnantoni

View GitHub Profile
@johnantoni
johnantoni / startup_mailer.py
Created December 31, 2013 16:21
raspberry pi - send email on startup (will need gmail account to send from)
import subprocess
import smtplib
import socket
from email.mime.text import MIMEText
import datetime
# Change to your own account information
to = 'me@example.com'
gmail_user = 'test@gmail.com'
gmail_password = 'yourpassword'
smtpserver = smtplib.SMTP('smtp.gmail.com', 587)
@johnantoni
johnantoni / tinyMCE fix for jquery validation
Created December 20, 2010 17:54
tinyMCE fix for use with jQuery.validation plugin and IE
// when using the jquery.validation plugin with a tinymce textarea you will need to write the contents of the tinymce area back into the original textarea for jquery.validation to pick up it's new value
// force tinymce content to be written back into original textarea element
var content = tinyMCE.activeEditor.getContent();
$("textarea.tinymce").val(content);
// if all else fails
tinyMCE.triggerSave();
after this you can safely apply jquery validation ala...
@johnantoni
johnantoni / zsh prompt with rbenv
Created August 20, 2012 03:05
zsh prompt + rbenv
# Prompt
# local smiley="%(?,%{$fg[green]%}☺%{$reset_color%},%{$fg[red]%}☹%{$reset_color%})"
# PROMPT='
# %~
# ${smiley} %{$reset_color%}'
# RBENV
# RPROMPT='%{$fg[white]%} $(rbenv version-name)$(~/.dotfiles/bin/git-cwd-info.rb)%{$reset_color%}'
@johnantoni
johnantoni / raspberry-pi.printer.md
Created January 12, 2014 19:53
raspberry pi printer server with cups
sudo apt-get -y install cups

sudo usermod -a -G lpadmin pi

sudo nano /etc/cups/cupsd.conf

comment out: Listen localhost:631

and replace with: Port 631

@johnantoni
johnantoni / gist:07df65898456ace4307d5bb6cbdc7f51
Last active April 3, 2022 16:31 — forked from mgmilcher/gist:5eaed7714d031a12ed97
Nginx, PHP-FPM, MySQL and phpMyAdmin on OS X

This is my take on how to get up and running with NGINX, PHP-FPM, MySQL and phpMyAdmin on OSX Yosemite.

This article is adapted from the original by Jonas Friedmann. Who I just discovered is from Würzburg in Germany. A stonesthrow from where I was born ;)

Xcode

Make sure you have the latest version of XCode installed. Available from the Mac App Store.

Install the Xcode Command Line Tools:

xcode-select --install

@johnantoni
johnantoni / mongoid.group.txt
Created October 23, 2012 15:08
mongoid group by
products.collection.group(:key => 'family', :initial => {count: 0}, :reduce => "function(doc,prev) { prev.count += +1; }")
products.collection.group(:keyf => 'function(doc) { return {family: doc.family};}', :initial => {count: 0}, :reduce => "function(doc,prev) { prev.count += +1; }", :finalize => 'function(doc) { doc; }')
@johnantoni
johnantoni / dd-wrt.markdown
Last active August 15, 2020 17:52
DD-WRT on WRT54G + OpenVPN

for a Linksys WRT54G router (v2.0)

  1. download the openvpn firmware version from http://www.dd-wrt.com/dd-wrtv2/down.php?path=downloads%2Fothers%2Feko%2FV24_TNG%2Fsvn13491-snow%2FVINT/
  2. set you static ip to 192.168.1.7 and connect directly to the router via ethernet cable, disconnect internet from the router.
  3. once connected, update the firmware with the one you just downloaded from the link above.
  4. once done, successfully, reboot.
  5. re-connect the internet cable.
  6. 99% of the time it will reboot, though there's a fine chance of bricking the router so if you can get one from a yardsale, cheaper that way.
  7. once booted, navigate browser to 192.168.1.1
  8. login, the username & password could be either root/root root/admin admin/admin admin/password root/password.
@johnantoni
johnantoni / install.md
Last active April 27, 2020 15:44
install duplicity on centos 64bit

check os

cat /etc/redhat-release

install repo

sudo rpm -Uvh http://mirrors.kernel.org/fedora-epel/6/x86_64/epel-release-6-8.noarch.rpm
yum repolist

install duplicity

@johnantoni
johnantoni / Contract Killer 3.md
Created February 11, 2016 22:25 — forked from malarkey/Contract Killer 3.md
The latest version of my ‘killer contract’ for web designers and developers

Contract Killer

The popular open-source contract for web designers and developers by Stuff & Nonsense

  • Originally published: 23rd December 2008
  • Revised date: October 8th 2015
  • Original post