Skip to content

Instantly share code, notes, and snippets.

@WaYdotNET
WaYdotNET / index.md
Created February 28, 2013 22:42 — forked from rstacruz/index.md

Rails Models

Generating models

$ rails g model User

Associations

belongs_to

has_one

// jQuery.naturalWidth / jQuery.naturalHeight plugin for (already-loaded) images
// Triple-licensed: Public Domain, MIT and WTFPL license - share and enjoy!
(function($) {
function img(url) {
var i = new Image;
i.src = url;
return i;
}
@WaYdotNET
WaYdotNET / Vagrantfile
Last active August 29, 2015 14:08 — forked from gasman/Vagrantfile
# -*- mode: ruby -*-
# vi: set ft=ruby :
Vagrant::Config.run do |config|
# Base box to build off, and download URL for when it doesn't exist on the user's system already
config.vm.box = "wagtail-base-v0.1"
config.vm.box_url = "http://downloads.torchbox.com/wagtail-base-v0.1.box"
# You can also build from a vanilla precise32 box, although it'll take longer
#!/bin/bash
DJANGO_VERSION=1.4
VENV="django$DJANGO_VERSION"
# create virtualenv: "django<version>" e.g. django1.4
mkdir lib
cd lib
virtualenv --system-site-packages $VENV
cd $VENV
@WaYdotNET
WaYdotNET / swap.yml
Created February 25, 2016 13:46 — forked from manuelmeurer/swap.yml
Ansible role for creating a Swap file
- name: set swap_file variable
set_fact:
swap_file: /mnt/{{ swap_space }}.swap
- name: check if swap file exists
stat:
path: "{{ swap_file }}"
register: swap_file_check
- name: create swap file
@WaYdotNET
WaYdotNET / nginx.conf
Created May 29, 2016 15:43 — forked from minostro/gist:11387989
Configuring Nginx on Webfaction

1.- Get into the src folder, download & extract nginx source

  • cd ~/src
  • curl -O http://nginx.org/download/nginx-1.7.0.tar.gz
  • tar -xzvf nginx-1.7.0.tar.gz
  • cd nginx-1.7.0

2.- Configuring the source

./configure --prefix=$HOME/local/nginx \

@WaYdotNET
WaYdotNET / gencert.py
Created November 4, 2016 16:42 — forked from toolness/gencert.py
Python script to create server SSL certs and sign them with a custom CA.
#! /usr/bin/python
"""
This simple script makes it easy to create server certificates
that are signed by your own Certificate Authority.
Mostly, this script just automates the workflow explained
in http://www.tc.umn.edu/~brams006/selfsign.html.
Before using this script, you'll need to create a private
@WaYdotNET
WaYdotNET / supervisord-example.conf
Created November 29, 2016 17:27 — forked from didip/supervisord-example.conf
Example configuration file for supervisord.conf
[unix_http_server]
file=/tmp/supervisor.sock ; path to your socket file
[supervisord]
logfile=/var/log/supervisord/supervisord.log ; supervisord log file
logfile_maxbytes=50MB ; maximum size of logfile before rotation
logfile_backups=10 ; number of backed up logfiles
loglevel=error ; info, debug, warn, trace
pidfile=/var/run/supervisord.pid ; pidfile location
nodaemon=false ; run supervisord as a daemon
@WaYdotNET
WaYdotNET / __readme.md
Created January 17, 2017 13:26 — forked from maxivak/__readme.md
Building Docker image with Packer and provisioning with Ansible

Building Docker image with Packer and provisioning with Ansible

Overview

Packer

  • Packer is used to build image from a base image, perform provisions and store (commit) the final image.

  • We use provisioners and Packer templates to do the actual work to create the final image.

  • We use Ansible for provisioning.

# sudo su and run the following
sudo aptitude update
# install all dependencies
sudo aptitude -y install \
python-pip \
python2.7-dev \
libssl-dev \
libcurl4-openssl-dev \