- Install homebrew.
brew install rbenv ruby-build
echo 'eval "$(rbenv init -)"' >> $HOME/.bash_profile
rbenv install 1.9.2-p290
rbenv global 1.9.2-p290
rbenv rehash
gem install bundler rails
var DateHelper = { | |
// Takes the format of "Jan 15, 2007 15:45:00 GMT" and converts it to a relative time | |
// Ruby strftime: %b %d, %Y %H:%M:%S GMT | |
time_ago_in_words_with_parsing: function(from) { | |
var date = new Date; | |
date.setTime(Date.parse(from)); | |
return this.time_ago_in_words(date); | |
}, | |
time_ago_in_words: function(from) { |
namespace :assets do | |
desc "Display asset path" | |
task :paths => :environment do | |
Rails.application.config.assets.paths.each do |path| | |
puts path | |
end | |
end | |
end |
In this article, I'll walk through a basic Rails (3.2.x) setup for creating a nested resource for two models. Nested resources work well when you want to build out URL structure between two related models, and still maintain a RESTful convention. This code assumes you are running RVM to manage Ruby/Gem versions, and Git for version control.
$ mkdir family # create rvm gemset
$ echo "rvm use --create ruby-1.9.2@family" > family/.rvmrc
$ cd family # install rails
$ gem install rails # create new rails project
$ rails new . # version control
class puppetlabs { | |
# Install Puppet repository and call apt-get update | |
case $operatingsystem { | |
ubuntu: { | |
$key = "4BD6EC30" | |
exec { 'apt-key puppetlabs': | |
path => "/bin:/usr/bin", | |
unless => "apt-key list | grep '${key}' | grep -v expired", | |
command => "apt-key adv --keyserver keyserver.ubuntu.com --recv-keys ${key}", | |
} |
#!/usr/bin/perl | |
# | |
# Update the path to your lease file below | |
use strict; | |
use File::Copy; | |
#use DateTime; | |
#always parse a copy not the live file | |
#my $leasefile = '/var/lib/dhcpd/dhcpd.leases'; | |
my $leasefile = '/var/lib/dhcp/db/dhcpd.leases'; |
Simple Dashing widget to countdown until a certain moment. Flashes the widget when finished.
##Usage
To use this widget, copy countdown.html
, countdown.coffee
, and countdown.scss
into the /widgets/countdown
directory.
To include the widget in a dashboard, add the following snippet to the dashboard layout file:
#!/bin/bash | |
# | |
# transcode-video.sh | |
# | |
# Copyright (c) 2013-2015 Don Melton | |
# | |
about() { | |
cat <<EOF | |
$program 5.13 of April 8, 2015 |
# The blog post that started it all: https://neocities.org/blog/the-fcc-is-now-rate-limited | |
# | |
# Current known FCC address ranges: | |
# https://news.ycombinator.com/item?id=7716915 | |
# | |
# Confirm/locate FCC IP ranges with this: http://whois.arin.net/rest/net/NET-165-135-0-0-1/pft | |
# | |
# In your nginx.conf: | |
location / { |
When you are unable to login to the unifi controller or forgot admin password, you can restore access using SSH and manipulating mongodb directly.
Do not uninstall unifi controller - most of the data is not stored in mongodb. In case you thought a mongodb backup would be sufficient, you may have fucked up already, just like me. However I managed to write this "tutorial" for anyone to not run into the same trap.
Apparently this guide no longer works with recent unifi controller versions (starting nov/dec 2022). Since I no longer use unifi hardware in my home system, I can not update the guide myself. In case you've gotten here to recover your data, you're likely doomed. But giving it a try won't hurt anyway, therefore: good luck.