sudo apt-get update && sudo apt-get upgrade && sudo apt-get dist-upgrade && sudo apt-get autoremove
sudo reboot
# Because we have some old legacy users in the database, we need to | |
# override #has_secure_passwords' method for checking if a password is valid. | |
# We first ask if the password is valid, and if it throws an InvalidHash | |
# exception, we know that we're dealing with a legacy user, so we check the | |
# password against the SHA1 algorithm that was used to hash the password in | |
# the old database. | |
#SOURCES OF SOLUTION: | |
# http://stackoverflow.com/questions/6113375/converting-existing-password-hash-to-devise | |
# https://github.com/binarylogic/authlogic/blob/master/lib/authlogic/crypto_providers/sha512.rb |
#!/usr/bin/ruby | |
# encoding: utf-8 | |
# Pings Apple events page until the video is posted | |
# Videos are usually live ~6 hours after official start time | |
# | |
# $ git clone https://gist.github.com/3711799.git appleevent | |
# $ ruby appleevent/appleevent.rb | |
require 'date' |
function computeSunrise(day, sunrise) { | |
/*Sunrise/Sunset Algorithm taken from | |
http://williams.best.vwh.net/sunrise_sunset_algorithm.htm | |
inputs: | |
day = day of the year | |
sunrise = true for sunrise, false for sunset | |
output: | |
time of sunrise/sunset in hours */ |
# Dependencies | |
# | |
# $ gem install icalendar | |
# | |
# Usage | |
# | |
# $ git clone https://gist.github.com/5104840.git f1calendar | |
# $ ruby f1calendar/f1calendar.rb | |
# | |
# FORMULA 1 GRANDE PRÊMIO DO BRASIL 2015 - Sao Paulo - 2015-11-13 12:00:00 UTC - Practice 1 |
(* | |
A [native solution][1] exists but it suffers from a major flaw: it right-clicks where the cursor is, not what on the selection. | |
This code addresses that limitation, though it only works on Finder windows and not the Desktop. | |
You can install it as a [Finder Service, and later asign it a keyboard shortcut][2]. | |
[1]: http://stackoverflow.com/questions/9171613/right-click-shortcut-for-mac-lion-os | |
[2]: http://www.macosxautomation.com/services/learn/tut01/index.html | |
*) |
http = require 'http' | |
yellIP = (callbacks, data) -> | |
console.log "OI!! YOUR IP IS #{data.ip}!!!" | |
printIP = (callbacks, data) -> | |
console.log "Your IP address: #{data.ip}" | |
parseJSON = (callbacks, string) -> | |
callbacks.shift()(callbacks, JSON.parse(string)) |
<?php | |
//----------------------------------------------------------/ | |
// responsive images [ 1) add img-responsive class 2) remove dimensions ] | |
//----------------------------------------------------------/ | |
function bootstrap_responsive_images( $html ){ | |
$classes = 'img-responsive'; // separated by spaces, e.g. 'img image-link' | |
// check if there are already classes assigned to the anchor | |
if ( preg_match('/<img.*? class="/', $html) ) { |
#!/bin/bash | |
# -------------------------------------------------------------------------------------------- | |
# Installs Ruby using rbenv/ruby-build on the Raspberry Pi (Raspbian) | |
# | |
# Run from the web: | |
# bash <(curl -s https://gist.githubusercontent.com/blacktm/8302741/raw/install_ruby_rpi.sh) | |
# -------------------------------------------------------------------------------------------- | |
# Set the Ruby version you want to install |
Some parts taken from: https://gist.github.com/kujohn/7209628
ipfw
is officially deprecated and removed in OS X Yosemite. Pow requires another program pf
to handle the port forwarding.
Create file /etc/pf.anchors/pow