Skip to content

Instantly share code, notes, and snippets.

Spritle Software spritle

Block or report user

Report or block spritle

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@spritle
spritle / sidekiq-monitor.sh
Created Jan 18, 2017
Monitor Sidekiq up or down with Shell Script.
View sidekiq-monitor.sh
process='sidekiq' # process name, you can use this to monitor any process
project_path="/home/ubuntu/apps/demo/" # This is the one you got to change on your side for your server.
#change it based on your configs.
start_service="bundle exec sidekiq -d -C /home/ubuntu/apps/demo/config/sidekiq.yml -i 0 -P /home/ubuntu/apps/demo/tmp/pids/sidekiq.pid -L /home/ubuntu/apps/demo/log/sidekiq.log"
# Method to simply store last run time in monitor.log file.
function update_last_run() {
current_time=$(date +'%d/%m/%Y %H:%M:%S')
View guesswho.txt
undef: 2312 times
user [preauth]: 76 times
ftpuser [preauth]: 74 times
guest [preauth]: 73 times
webmaster [preauth]: 68 times
admin [preauth]: 67 times
oracle [preauth]: 65 times
test [preauth]: 54 times
master [preauth]: 52 times
ftp [preauth]: 51 times
View sample.json
{"response":[{"id":36,"name":"Sync Test","client_name":"Eventstream","created_at":"2015-06-25T14:16:58.943Z","updated_at":"2015-07-27T11:38:42.683Z","event_date":"06/25/2015","local_ip_address":"","local_stream_name":"","local_port":0,"live_stream_name":"synctest1","active_twitter":false,"twitter_handle":"#toronto","allow_live_streaming":false,"event_id":"SYNCTEST1","allow_event_access":true,"live_wowza_url":"http://cdn.kastio.com/livetouch","record_on_server":false,"playback_recording":false,"allow_remote_vod_streaming":true,"vod_filename":"uploads/1435241756252-jahidqqvzhbyb9-061ec137210e43cf42d4bea36a03f96f/synctest.mp4","allow_local_streaming":false,"local_protocal":"udp","local_mode":"Multicast","local_wifi_ssid":"","vod_wowza_url":"http://cdn.kastio.com/livetouch-vods3/_definst_/mp4:amazons3/livetouch-vod","vod_filename_suffix":"playlist.m3u8","single_camera_view":true,"overlay_title":"Sync Test","overlay_message":"Working Fine...!!!","overlay_date_time":"2015-07-14 19:08:00","overlay_enabled":true,"liv
View delayed_job.rb
# run with: god -c /path/to/config.god [add -D if you want to not-deamonize god]
# This is the actual config file used to keep the delayed_job running
APPLICATION_ROOT = "/var/www/application"
RAILS_ENV = "production"
God.watch do |w|
w.name = "delayed_job_production"
w.interval = 15.seconds
w.start = "/bin/bash -c 'cd #{APPLICATION_ROOT}/current; /usr/bin/env RAILS_ENV=#{RAILS_ENV} #{APPLICATION_ROOT}/current/script/delayed_job start > /tmp/delay_job.out'"
View Install_tmux
# First install tmux
brew install tmux
# For mouse support (for switching panes and windows)
# Only needed if you are using Terminal.app (iTerm has mouse support)
Install http://www.culater.net/software/SIMBL/SIMBL.php
Then install https://bitheap.org/mouseterm/
# More on mouse support http://floriancrouzat.net/2010/07/run-tmux-with-mouse-support-in-mac-os-x-terminal-app/
@spritle
spritle / ismysql-alive.sh
Last active Jan 4, 2016
MySQL Server Status Monitor
View ismysql-alive.sh
netstat -na | grep LISTEN | grep MYSQL_PORT
if [ $? != 0 ]; then
sudo service mysql start
#send email
fi
#Make the script executable
# $ chmod +x isalive.sh
#Add it to crontab (say every 10 minutes)
@spritle
spritle / mail.sh
Created Jan 24, 2014
Set mail or mailx from address
View mail.sh
echo "Site Down" | mail -r from@foo.com -s "Site Down" to@foo.com
View ruby2_1_rails4_1-setup.md

Setting up Ruby, Rails, Nginx, Passenger, PostgreSQL 9 on Ubuntu 12.04 LTS for Windows Azure

Last updated: 12/31/2013

Fix the locale issue

  • Edit /etc/default/locale as sudo.
  • Append LC_ALL="en_US.UTF-8" at the end of the file, save and quit.
  • sudo locale-gen en_US en_US.UTF-8
  • sudo dpkg-reconfigure locales

Install the necessary packages to install rbenv and build Ruby

View mail-using-gmail.rb
#!/usr/bin/env ruby
# Mails a file using GMail's SMTP Server.
# For illustrative purposes; error checking and testing intentionally omitted for brevity.
#
# Requirements:
# 1) the 'mail' gem must be installed
# 2) a file named 'pw.txt' containing the Google password must be present
# in the current directory.
#
# Ruby versions: tested on 1.9.3, 1.8.7, JRuby
@spritle
spritle / mobile_app_sample_code.rb
Created Apr 26, 2013
mobile_app_sample_code.rb
View mobile_app_sample_code.rb
require 'rho/rhocontroller'
require 'lib/flow/login_flow'
require 'lib/flow/new_trip_flow'
require 'lib/flow/transfer_detail_flow'
module UHS
# Base controller providing commonly used functionality
class BaseController < Rho::RhoController
end
class UhsController < BaseController
You can’t perform that action at this time.