Skip to content

Instantly share code, notes, and snippets.

View samuels410's full-sized avatar
🎯
Focusing

samuel santhosh samuels410

🎯
Focusing
View GitHub Profile
#!/bin/sh
# upstart-job
#
# Symlink target for initscripts that have been converted to Upstart.
set -e
APP_PATH="/var/deploy/app/current"
start_job() {
echo "Starting delayed job"
#!/bin/sh
# upstart-job
#
# Symlink target for initscripts that have been converted to Upstart.
set -e
APP_PATH="/srv/rails/seek"
start_job() {
echo "Starting delayed job"
@samuels410
samuels410 / no-pass.sh
Created December 1, 2014 09:34
Create Multiple SSH Configurations to login remote servers without asking password
#!/bin/bash
# Create Multiple SSH Configurations
#1. Clone the script
#2. chmod +x no-pass.sh
#3. ./no-pass.sh
touch ~/.ssh/config || exit
echo -e "\e[33m Enter domain/ipaddress which you want to ssh:"
read domain_name
<!doctype html>
<title>Site Maintenance</title>
<style>
body { text-align: center; padding: 150px; }
h1 { font-size: 50px; }
body { font: 20px Helvetica, sans-serif; color: #333; }
article { display: block; text-align: left; width: 650px; margin: 0 auto; }
a { color: #dc8100; text-decoration: none; }
a:hover { color: #333; text-decoration: none; }
</style>
@samuels410
samuels410 / a-server-setup.sh
Created August 14, 2015 11:44
First time server setup
sudo apt-get update && /
sudo apt-get install byobu && /
sudo apt-get install vim && /
sudo apt-get install htop && /
sudo apt-get install postgresql-9.3
@samuels410
samuels410 / change_db_owner.sh
Last active September 13, 2015 05:05 — forked from gingerlime/change_db_owner.sh
Postgresql - Changing ownership on all tables
#!/bin/bash
usage()
{
cat << EOF
usage: $0 options
This script set ownership for all table, sequence and views for a given database
Credit: Based on http://stackoverflow.com/a/2686185/305019 by Alex Soto
@samuels410
samuels410 / gist:0464703dc2a581b8909d
Created November 5, 2015 10:54 — forked from sebsto/gist:19b99f1fa1f32cae5d00
Install Maven with Yum on Amazon Linux
sudo wget http://repos.fedorapeople.org/repos/dchen/apache-maven/epel-apache-maven.repo -O /etc/yum.repos.d/epel-apache-maven.repo
sudo sed -i s/\$releasever/6/g /etc/yum.repos.d/epel-apache-maven.repo
sudo yum install -y apache-maven
mvn --version
@samuels410
samuels410 / fizz_buzz.rb
Created February 10, 2016 06:18
Fiz buzz
def fizzbuzz(range, triggers)
range.each do |i|
result = ''
triggers.each do |(text, divisor)|
result << text if i % divisor == 0
end
puts result == '' ? i : result
end
end
- Stop delayed jobs (canvas_init stop)
- Shut down canvas
- Remove the 'queue' section from database.yml
- Import the necessary functions from the queue DB into the main one. I have them in a gist here: https://gist.github.com/grahamb/4ac964d9e40de7ca9559. You can also get them by doing a full dump of the queue DB. To import them, save to a file (e.g. functions.sql) and do 'cat functions.sql | psql -h yourdbserverhostname -U canvas canvas_production' (assuming you're using the default username and DB name)
- Dump the delayed and failed jobs tables to a file: 'dump -h yourdbserverhostname -U canvas -C -t delayed_jobs -t failed_jobs > jobs.sql'
- Import the dump file into the main canvas DB: 'cat jobs.sql | psql -h yourdbserverhostname U canvas canvas_production'
- Assuming no errors above, restart delayed jobs (canvas_init start) and Canvas.
- Check your delayed jobs log and /jobs to make sure everything is working.
redis-cli FLUSHDB
redis-cli FLUSHALL