This repo's location has changed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# include this in application controller | |
module Authentication | |
protected | |
# Inclusion hook to make #current_user and #signed_in? | |
# available as ActionView helper methods. | |
def self.included(base) | |
base.send :helper_method, :current_user, :signed_in?, :authorized? if base.respond_to? :helper_method | |
end | |
# Returns true or false if the user is signed in. |
Quick demo on how to use Jade and CodeMirror to create a simple Jade editor with live preview.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Tested Environment | |
# Windows7 x64, MS Access2010/2013, sequel 4.11.0 | |
# Gemfile | |
# source 'https://rubygems.org' | |
# gem 'sequel' | |
# gem 'ruby-odbc' # for ODBC | |
require 'sequel' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
task(){ | |
LC_ALL=C nc -vzw5 portquiz.net $1 2>&1 | grep -v 'Connection timed out' | |
} | |
N=50 # Specify number of ports to check at once | |
( | |
for port in {1..65535}; do # Specify port range to check here | |
((i=i%N)); ((i++==0)) && wait |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Turn DD-WRT wireless radio on for business hours only. Verify wireless interface for your router model. | |
# Place in WebUI > Administration > Management > Cron | |
0 18 * * 1,2,3,4,5 root wl -i eth1 radio off | |
0 6 * * 1,2,3,4,5 root wl -i eth1 radio on |
#Here is how I keep my secrets out of my source code when working with OpenShift
-
find your app's ssh address:
rhc app show YOUR_APP_NAME
-
ssh into your gear to set your environment variables:
ssh YOUR_APPS_SSH_URL
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# use this if you have a systemctl --user script. Runs it as a user. | |
[Unit] | |
Description=Keeps a tunnel to 'remote.example.com' open | |
After=network.target | |
[Service] | |
# -p [PORT] | |
# -l [user] | |
# -M 0 --> no monitoring |
- Install getmail (aptitude install getmail4)
- Set Up Your Imap Server (tl;dr)
- getmail
ruby date_based_archive.rb ~/Maildir/.Archive
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'bcrypt' | |
class User | |
include DataMapper::Resource | |
attr_accessor :password, :password_confirmation, :password_reset | |
timestamps :at | |
property :id, Serial |
NewerOlder