Skip to content

Instantly share code, notes, and snippets.

View kamal-github's full-sized avatar
:octocat:
Focusing

Kamal Namdeo kamal-github

:octocat:
Focusing
View GitHub Profile
@kamal-github
kamal-github / Bear_and_Steady_Gene.cpp
Created April 10, 2016 13:51
Bear and Steady Gene (CPP program)
bool validityCheck(map<char, int> dict, int limit){
if(dict['A'] <= limit && dict['C'] <= limit && dict['G'] <= limit && dict['T'] <= limit){
return true;
}else{
return false;
}
}
int main() {
int N, maxIndex = 0, out = 999999;
set nocompatible " be iMproved, required
filetype off " required
" set the runtime path to include Vundle and initialize
set rtp+=~/.vim/bundle/Vundle.vim
call vundle#begin()
" let Vundle manage Vundle, required
Plugin 'VundleVim/Vundle.vim'
# Path to your oh-my-zsh installation.
export ZSH=/Users/kamal/.oh-my-zsh
# Set name of the theme to load.
# Look in ~/.oh-my-zsh/themes/
# Optionally, if you set this to "random", it'll load a random theme each
# time that oh-my-zsh is loaded.
ZSH_THEME="agnoster"
# Uncomment the following line to use case-sensitive completion.

###MYSQL We've installed your MySQL database without a root password. To secure it run: mysql_secure_installation

To connect run: mysql -uroot

To have launchd start mysql now and restart at login: brew services start mysql Or, if you don't want/need a background service you can just run:

The Homebrew package manager includes launchctl plists to start automatically. For more information run brew info postgres.

Start manually:

pg_ctl -D /usr/local/var/postgres -l /usr/local/var/postgres/server.log start

Stop manually:

pg_ctl -D /usr/local/var/postgres stop -s -m fast

snippet art
assert_redirected_to ${1:action}: '${2:index}'
snippet artnp
assert_redirected_to ${1:parent}_${2:child}_path(${3:@$1}, ${0:@$2})
snippet artnpp
assert_redirected_to ${1:parent}_${2:child}_path(${0:@$1})
snippet artp
assert_redirected_to ${1:model}_path(${0:@$1})
snippet artpp
assert_redirected_to ${0:model}s_path
require 'sneakers'
Sneakers.configure heartbeat: 5,
amqp: ENV['RABBITMQ_BIGWIG_URL'] || 'amqp://guest:guest@localhost:5672/order',
workers: 1,
timeout_job_after: 60,
threads: 5,
prefetch: 5,
after_fork: Proc.new { ActiveRecord::Base.establish_connection },
durable: true
@kamal-github
kamal-github / gist:b89802cc06b1fae85666fa0028b9526a
Created August 25, 2016 04:53
Include this module to make your class instance variable accessible to subclass which doesn't declare that variable(ref - http://www.railstips.org/blog/archives/2006/11/18/class-and-instance-variables-in-ruby/)
module ClassLevelInheritableAttributes
def self.included(base)
base.extend(ClassMethods)
end
module ClassMethods
def inheritable_attributes(*args)
@inheritable_attributes ||= [:inheritable_attributes]
@inheritable_attributes += args
args.each do |arg|
@kamal-github
kamal-github / jpaContext.xml
Created October 18, 2016 04:15 — forked from v-r/jpaContext.xml
jpaConfig.xml
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:tx="http://www.springframework.org/schema/tx"
xmlns:context="http://www.springframework.org/schema/context"
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.2.xsd
http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.2.xsd
http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-3.2.xsd">
<context:annotation-config />
<context:component-scan base-package="com.lorem.Todo" />