Skip to content

Instantly share code, notes, and snippets.

View johncalvinyoung's full-sized avatar

John Calvin Young johncalvinyoung

  • RoleModel Software
View GitHub Profile
@johncalvinyoung
johncalvinyoung / phantomjs
Created March 10, 2016 21:29 — forked from deviantony/phantomjs
Installer script to setup phantomjs 1.9.7, it will remove any previous setup. Contains also the init script to manage phantomjs as a system service and the default configuration file. Tested on Ubuntu 12.04.
#! /bin/sh
# Init. script for phantomjs, based on Ubuntu 12.04 skeleton.
# Author: Anthony Lapenna <lapenna.anthony@gmail.com>
PATH=/sbin:/usr/sbin:/bin:/usr/bin
DESC="Phantomjs service"
NAME=phantomjs
DAEMON=/usr/bin/$NAME
PIDFILE=/var/run/$NAME.pid
SCRIPTNAME=/etc/init.d/$NAME
/var/log/<project>/*.log {
daily
rotate 30
missingok
copytruncate
compress
delaycompress
notifempty
olddir /var/log/<project>/history
dateext

Keybase proof

I hereby claim:

  • I am johncalvinyoung on github.
  • I am johncalvinyoung (https://keybase.io/johncalvinyoung) on keybase.
  • I have a public key whose fingerprint is 111B 9C20 F2A6 D235 0F72 355D 69EA D789 9F1C 5F2A

To claim this, I am signing this object:

#!/bin/bash
### BEGIN INIT INFO
# Provides: sidekiq beta
# Required-Start: $syslog $remote_fs
# Required-Stop: $syslog $remote_fs
# Should-Start: $local_fs
# Should-Stop: $local_fs
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: sidekiq for fieldvault
Architecture: Rails 3.2, Solr 1.4 with sunspot_solr gem, Apache HTTP server as reverse proxy to
Rails app, Jquery UI
Note: I don't care about the distinction between autocomplete and autosuggest. I am implementing what some
people call autosuggest, and I'm calling it autocomplete.
Given the above existing architecture, I want to add an autocomplete field into my app for a single
attribute on a single model. It needs to be fast and secure (duh). The search target field could have
white space and the search input should allow it, e.g., if I search with "iker's gui" it should return
@johncalvinyoung
johncalvinyoung / unicorn.sh
Last active December 15, 2015 19:59 — forked from 0h546f6f78696342756e4e59/gist:2636887
Gentoo startup script for unicorn
#!/sbin/runscript
# unicorn init script for Gentoo Linux
APP_ROOT=/var/www/apps/your_app
RAILS_ROOT=$APP_ROOT/current
USER=your_user
extra_commands="reload"
depend() {
@johncalvinyoung
johncalvinyoung / unicorn
Last active December 12, 2015 06:59 — forked from shapeshed/unicorn
#!/bin/sh
set -e
# Example init script, this can be used with nginx, too,
# since nginx and unicorn accept the same signals
# Feel free to change any of the following variables for your app:
TIMEOUT=${TIMEOUT-60}
USER=your_deploy_user
APP_ROOT=/path/to/app/
CURRENT_ROOT=$APP_ROOT/current
# Update, upgrade and install development tools:
apt-get update
apt-get -y upgrade
apt-get -y install build-essential
apt-get -y install git-core curl
apt-get -y install libssl-dev
apt-get -y install libreadline5 libreadline5-dev
apt-get -y install zlib1g zlib1g-dev
# for passenger needed
#!/bin/bash
# CentOS rbenv system wide installation script
# Forked from https://gist.github.com/1237417
# Installs rbenv system wide on CentOS 5/6, also allows single user installs.
# Install pre-requirements
yum install -y gcc-c++ patch readline readline-devel zlib zlib-devel libyaml-devel libffi-devel openssl-devel \
make bzip2 autoconf automake libtool bison iconv-devel git-core
@johncalvinyoung
johncalvinyoung / gist:3207142
Created July 30, 2012 14:10
Read-write for go_fish game
def save(game)
File.open(game.key, 'w') do |file|
file.write(game.to_yaml)
end
end
def retrieve(game_id)
File.open(game_id, 'r') do |file|
YAML::load(file)
end