Skip to content

Instantly share code, notes, and snippets.

View jgeiger's full-sized avatar

Joey Geiger jgeiger

View GitHub Profile
$("#new_user #user_password").passwordCheck();
jQuery.fn.passwordCheck = function() {
var pass = $(this[0]) // It's your element
var noofchar=/^.*(?=.{6,}).*$/;
var checkspace=/\s/;
var best=/^.*(?=.{6,})(?=.*[A-Z])(?=.*[\d])(?=.*[\W]).*$/;
var strong=/^[a-zA-Z\d\W_]*(?=[a-zA-Z\d\W_]{6,})(((?=[a-zA-Z\d\W_]*[A-Z])(?=[a-zA-Z\d\W_]*[\d]))|((?=[a-zA-Z\d\W_]*[A-Z])(?=[a-zA-Z\d\W_]*[\W_]))|((?=[a-zA-Z\d\W_]*[\d])(?=[a-zA-Z\d\W_]*[\W_])))[a-zA-Z\d\W_]*$/;
var weak=/^[a-zA-Z\d\W_]*(?=[a-zA-Z\d\W_]{6,})(?=[a-zA-Z\d\W_]*[A-Z]|[a-zA-Z\d\W_]*[\d]|[a-zA-Z\d\W_]*[\W_])[a-zA-Z\d\W_]*$/;
var bad=/^((^[a-z]{6,}$)|(^[A-Z]{6,}$)|(^[\d]{6,}$)|(^[\W_]{6,}$))$/;
export PATH=$HOME/.gems/bin:$HOME/opt/bin:$PATH
export GEM_HOME=$HOME/.gems
export GEM_PATH="$GEM_HOME"
export RUBYLIB="$HOME/opt/lib:$RUBYLIB"
alias gem="nice -n19 ~/opt/bin/gem"
# create a new cron job at panel.dreamhost.com and run it daily (which will be midnight)
/home/account/opt/bin/logrotate -f -s /home/account/opt/lib/logrotate.status /home/account/opt/etc/logrotate.conf
@jgeiger
jgeiger / snippet.rb
Created April 22, 2011 18:56
using redis to reserve a set of records from a larger group
def find_for_curation(conditions, user_id)
RedisConnection.db.sadd('curators', user_id)
RedisConnection.db.del("curator-#{user_id}")
curator_ids = RedisConnection.db.smembers('curators')
curator_keys = curator_ids.map { |id| "curator-#{id}" }
active_annotation_ids = RedisConnection.db.sunion(*curator_keys)
annotations = Annotation.where(conditions).where("annotations.id NOT IN (#{active_annotation_ids.to_in_query_string})").joins(:ontology_term).joins(:ontology).limit(15).order('ontology_terms.name')
annotations.each do |annotation|
RedisConnection.db.sadd("curator-#{user_id}", annotation.id)
end
#!/bin/bash
# from here: http://www.codingsteps.com/install-redis-2-6-on-amazon-ec2-linux-ami-or-centos/
# and here: https://raw.github.com/gist/257849/9f1e627e0b7dbe68882fa2b7bdb1b2b263522004/redis-server
###############################################
# To use:
# wget https://gist.githubusercontent.com/dfetterman/cf7bc4aa53c47fb546c6/raw/e11cd22f41e6cab71fe621b1f5a1377ff3af01ab/install-redis.sh
# chmod 777 install-redis.sh
# ./install-redis.sh
###############################################
echo "*****************************************"
#!/bin/sh
#
# redis - this script starts and stops the redis-server daemon
#
# chkconfig: - 85 15
# description: Redis is a persistent key-value database
# processname: redis-server
# config: /etc/redis/redis.conf
# config: /etc/sysconfig/redis
# pidfile: /var/run/redis.pid
@jgeiger
jgeiger / redis.conf
Last active August 29, 2015 14:04 — forked from dfetterman/redis.conf
Redis configuration
# Redis configuration file example
# Note on units: when memory size is needed, it is possible to specify
# it in the usual form of 1k 5GB 4M and so forth:
#
# 1k => 1000 bytes
# 1kb => 1024 bytes
# 1m => 1000000 bytes
# 1mb => 1024*1024 bytes
# 1g => 1000000000 bytes
@jgeiger
jgeiger / redis-server.conf
Last active August 29, 2015 14:05
Redis upstart conf
description "Redis Server"
author "Thomas Woolford <thomas@urpages.com.au>"
# run when the local FS becomes available
start on local-filesystems
stop on shutdown
# The default redis conf has `daemonize = yes` and will naiively fork itself.
expect fork
@jgeiger
jgeiger / monit.conf
Created August 11, 2014 04:50
Monit upstart script
description "Monit service manager"
limit core unlimited unlimited
start on runlevel [2345]
stop on runlevel [!2345]
expect daemon
respawn
@jgeiger
jgeiger / monitrc
Last active August 29, 2015 14:05
monitrc
###############################################################################
## Monit control file
###############################################################################
##
## Start Monit in the background (run as a daemon):
set daemon 60 # check services at 1-minute intervals
set logfile syslog facility log_daemon