Skip to content

Instantly share code, notes, and snippets.

@burningTyger
burningTyger / authentication.rb
Created December 7, 2011 17:01 — forked from jnunemaker/authentication.rb
a starting point for authentication with mongomapper and rails
# 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.
@burningTyger
burningTyger / README.md
Created February 20, 2018 18:47 — forked from chrislkeller/README.md
Displaying data from a flat JSON file on a Handlebars.js template file rendered with AJAX.

Demo: ajax-handlebars

This repo's location has changed.

@burningTyger
burningTyger / README.md
Created January 28, 2017 20:15 — forked from pnavarrc/README.md
Jade Preview
@burningTyger
burningTyger / sequel_to_ms_access.rb
Created December 12, 2016 17:16 — forked from thinkAmi/sequel_to_ms_access.rb
Sequel: Connecting to Microsoft Access(*.accdb)
# 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'
@burningTyger
burningTyger / testports.sh
Created March 7, 2016 10:06 — forked from enginefeeder101/testports.sh
Test outgoing open ports
#!/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
# 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

  1. find your app's ssh address:

    rhc app show YOUR_APP_NAME

  2. ssh into your gear to set your environment variables:

    ssh YOUR_APPS_SSH_URL

@burningTyger
burningTyger / autossh.service
Last active October 18, 2015 19:56 — forked from thomasfr/autossh.service
Systemd service for autossh
# 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
@burningTyger
burningTyger / aa_instructions.md
Created May 2, 2012 13:42 — forked from NZKoz/aa_instructions.md
Back Up All Your Gmail
  • Install getmail (aptitude install getmail4)
  • Set Up Your Imap Server (tl;dr)
  • getmail
  • ruby date_based_archive.rb ~/Maildir/.Archive
@burningTyger
burningTyger / user.rb
Created August 13, 2011 08:35 — forked from namelessjon/user.rb
Example user with a BCrypt password
require 'bcrypt'
class User
include DataMapper::Resource
attr_accessor :password, :password_confirmation, :password_reset
timestamps :at
property :id, Serial