This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/bin/sh | |
| # ------------------------------------------------------------------------------ | |
| # SOME INFOS : fairly standard (debian) init script. | |
| # Note that node doesn't create a PID file (hence --make-pidfile) | |
| # has to be run in the background (hence --background) | |
| # and NOT as root (hence --chuid) | |
| # | |
| # MORE INFOS : INIT SCRIPT http://www.debian.org/doc/debian-policy/ch-opersys.html#s-sysvinit | |
| # INIT-INFO RULES http://wiki.debian.org/LSBInitScripts | |
| # INSTALL/REMOVE http://www.debian-administration.org/articles/28 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # A Basic API Controller for Rails | |
| # Handles authentication via Headers, params, and HTTP Auth | |
| # Automatically makes all requests JSON format | |
| # | |
| # Written for production code | |
| # Made public for: http://broadcastingadam.com/2012/03/state_of_rails_apis | |
| # | |
| # Enjoy! | |
| class ApiController < ApplicationController |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/usr/bin/env ruby | |
| # This is a basic deploy script for Heroku apps. | |
| # It provides a structure you can use to expand on | |
| # and add your own prereqs and deploy tasks. | |
| # | |
| # It basically ensures that: | |
| # 1. There are no uncommited files | |
| # 2. You can ssh to github | |
| # 3. You can connect to heroku |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # ruby 1.9 supports 4 ways to call a proc! ex: f =->n {[:hello, n]}; f[:ruby]; f.call(:ruby); f.(:ruby) | |
| # | |
| # turns out, you can also call a proc via proc === :arg -- which means you can use proc's in when clauses! | |
| # ruby doc: http://ruby-doc.org/ruby-1.9/classes/Proc.html#M001165 | |
| # | |
| # ... kudos to @chadfowler for the tip! | |
| # | |
| # (note: works on 1.8.7 as well :-)) | |
| def am_i_awesome? |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # In response to: | |
| # http://mlomnicki.com/ruby/tricks-and-quirks/2011/02/10/ruby-tricks2.html | |
| # Ruby 1.9.2 has some neat stuff that lets us make a readable | |
| # alternative case statement that calls each method in turn. | |
| # 1.9.2 features used: | |
| # * hashes are ordered in 1.9.2 | |
| # * cool JSON-style hash syntax | |
| # * concise lambda syntax |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| task :environment do | |
| require './dj-sinatra' | |
| end | |
| namespace :jobs do | |
| desc "Clear the delayed_job queue." | |
| task :clear => :environment do | |
| Delayed::Job.delete_all | |
| end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| [user] | |
| name = Pavan Kumar Sunkara | |
| email = [email protected] | |
| [core] | |
| editor = vim | |
| whitespace = fix,-indent-with-non-tab,trailing-space,cr-at-eol | |
| excludesfile = ~/.gitignore | |
| [sendemail] | |
| smtpencryption = tls | |
| smtpserver = smtp.gmail.com |
Open $ vim /etc/default/grub then add elevator=noop next to GRUB_CMDLINE_LINUX_DEFAULT. Run $ update-grub and $ cat /sys/block/sda/queue/scheduler to be sure that noop is being used:
$ vim /etc/default/grub
$ update-grub
$ cat /sys/block/sda/queue/scheduler
[noop] deadline cfq
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| " _ _ " | |
| " _ /|| . . ||\ _ " | |
| " ( } \||D ' ' ' C||/ { % " | |
| " | /\__,=_[_] ' . . ' [_]_=,__/\ |" | |
| " |_\_ |----| |----| _/_|" | |
| " | |/ | | | | \| |" | |
| " | /_ | | | | _\ |" | |
| It is all fun and games until someone gets hacked! |