Skip to content

Instantly share code, notes, and snippets.

View alameenkhader's full-sized avatar

Al Ameen Khader alameenkhader

  • Vista, California
View GitHub Profile
[
{
name: "Alabama",
abbreviation: "AL"
},
{
name: "Alaska",
abbreviation: "AK"
},
{
@alameenkhader
alameenkhader / visudo-user-access
Created February 20, 2014 12:21
How to add sudo permission to a particular command for a user
How to add sudo permission to a particular command for a user
Following example illustrates how to add apache restart access to the user nih
Login as root user
Then open visudo by typing in
visudo
Add the command to the end of the file
#username# ALL= NOPASSWD: #command#
nih ALL= NOPASSWD: /etc/init.d/httpd restart
@alameenkhader
alameenkhader / sublime-all-you-want.md
Last active October 4, 2018 06:17
Sublime - All you want
@alameenkhader
alameenkhader / bootstrap-w-rails.md
Last active August 29, 2015 14:06
Rails with bootstrap
  • Download bootstrap
  • Add bootstrap.js to vendor/assets/javascripts
  1. Add the following to app/assets/application.js
    //= require bootstrap
  2. Add bootstrap.css to vendor/assets/stylesheets
  3. Add the following to app/assets/application.css
    *= require bootstrap
  4. Add fonts to vendor/assets/fonts folder
  5. Add this to config/initializers/assets.rb
    config.assets.paths << "#{Rails}/vendor/assets/fonts"
@alameenkhader
alameenkhader / postgres-basics.md
Last active September 23, 2016 12:12
postgres - installation and basics

####Install the whole package
sudo apt-get install postgresql postgresql-contrib ####Install pgAdmin III - a handy GUI for PostgreSQL
sudo apt-get install pgadmin3

####Setup
#####Login to postgres sql prompt
sudo -u postgres psql postgres
#####Change the postgres user password
\password postgres

@alameenkhader
alameenkhader / cordova-android-sdk-setup
Created October 24, 2014 12:51
cordova-android-sdk-setup
install android sdk
download android sdk alone
unzip it
move a safe folder(remember the path)
set the ANDROID_HOME
export ANDROID_HOME=/home/user/android-sdk-linux
export ANDROID_HOME=~/android-sdk-linux
export PATH=$ANDROID_HOME/tools:$PATH
export PATH=$ANDROID_HOME/platform-tools:$PATH
@alameenkhader
alameenkhader / rspec-remember.md
Last active October 7, 2015 12:51
More - Rspec
@alameenkhader
alameenkhader / rails-rpush.md
Last active August 28, 2020 09:10
Rpush/Rails Integration

###rpush - https://github.com/rpush/rpush

Follow the steps in rpush to add the gem to your rails project

####PushNotificationDevice

rails g model PushNotificationDevice device_type:integer:index device_token:string
class CreatePushNotificationDevices < ActiveRecord::Migration
@alameenkhader
alameenkhader / rpush-monit.md
Created July 21, 2015 11:34
rpush-monit.md
@alameenkhader
alameenkhader / ubuntu-services.md
Last active September 10, 2015 06:10
Ubuntu Services | Start Up Scripts

###How to enable a service

As an example, to enable Apache web server in Debian, do the following -
update-rc.d apache2 defaults

... this will enable the Apache web server to start in the default run levels of 2,3,4 and 5. Of course, you can do it explicitly by giving the run levels instead of the defaults keyword as follows:
update-rc.d apache2 start 20 2 3 4 5 . stop 80 0 1 6 .

The above command modifies the sym-links in the respective /etc/rcX.d directories to start or stop the service in the destined runlevels. Here X stands for a value of 0 to 6 depending on the runlevel. One thing to note here is the dot (.) which is used to terminate the set which is important. Also 20 and 80 are the sequence codes which decides in what order of precedence the scripts in the /etc/init.d/ directory should be started or stopped.