Skip to content

Instantly share code, notes, and snippets.

@ktkaushik
ktkaushik / nginx.config
Last active December 21, 2015 05:19
config
user www-data;
worker_processes 1;
pid /var/run/nginx.pid;
events {
worker_connections 1024;
# multi_accept on;
}
http {
@ktkaushik
ktkaushik / result.sh
Created August 11, 2013 18:53
ps aux result
postgres 17541 0.0 0.2 5552 1452 pts/0 S Aug11 0:00 su postgres
postgres 17542 0.0 0.3 5568 1912 pts/0 S Aug11 0:00 bash
postgres 17693 0.0 0.2 5208 1188 pts/0 R+ 00:20 0:00 ps aux
postgres 17694 0.0 0.1 4392 824 pts/0 S+ 00:20 0:00 grep postgres
@ktkaushik
ktkaushik / first.json
Last active December 20, 2015 12:29
sails-mongoose model object
{ [Function: model]
base:
{ connections: [ [Object] ],
plugins: [],
models: { Person: [Circular], Post: [Object] },
modelSchemas: { Person: [Object], Post: [Object] },
options: {} },
modelName: 'Person',
model: [Function: model],
db:
@ktkaushik
ktkaushik / Article.js
Created July 25, 2013 13:32
Sails controller and model
/**
* Article
*
* @module :: Model
* @description :: A short summary of how this model works and what it represents.
*
*/
module.exports = {
@ktkaushik
ktkaushik / hack.sh
Created July 24, 2013 10:32
pro OS X with lot of options
#!/usr/bin/env bash
# ~/.osx — http://mths.be/osx
# Ask for the administrator password upfront
sudo -v
# Keep-alive: update existing `sudo` time stamp until `.osx` has finished
while true; do sudo -n true; sleep 60; kill -0 "$$" || exit; done 2>/dev/null &
@ktkaushik
ktkaushik / log.sh
Created July 23, 2013 10:56
Log of sails application
debug: --------------------------------------------------------
debug: :: Tue Jul 23 2013 16:15:08 GMT+0530 (IST)
debug:
debug: Environment : development
debug: Port : 1337
debug: --------------------------------------------------------
*************************************** you are in create action ***********************************************************
# this is req.params
[]
@ktkaushik
ktkaushik / req.sails.json
Created July 23, 2013 10:27
request object in sailsjs
{ domain: null,
_events: { data: [Function], end: [Function] },
_maxListeners: 10,
socket:
{ domain: null,
_events:
{ drain: [Function: ondrain],
timeout: [Object],
error: [Function],
close: [Object] },
@ktkaushik
ktkaushik / Bash_Pretty.sh
Created July 11, 2013 20:40
Bash pretty
#ck - Regular
txtred='\e[0;31m' # Red
txtgrn='\e[0;32m' # Green
txtylw='\e[0;33m' # Yellow
txtblu='\e[0;34m' # Blue
txtpur='\e[0;35m' # Purple
txtcyn='\e[0;36m' # Cyan
txtwht='\e[0;37m' # White
bldblk='\e[1;30m' # Black - Bold
bldred='\e[1;31m' # Red
@ktkaushik
ktkaushik / jugglingdb.json
Created July 11, 2013 13:14
User and Post model object
User:
{ [Function: ModelConstructor]
validatesPresenceOf: [Function],
validatesLengthOf: [Function],
validatesNumericalityOf: [Function],
validatesInclusionOf: [Function],
validatesExclusionOf: [Function],
validatesFormatOf: [Function],
validate: [Function],
validateAsync: [Function],
# These are my notes from the PragProg book on CoffeeScript of things that either
# aren't in the main CS language reference or I didn't pick them up there. I wrote
# them down before I forgot, and put it here for others but mainly as a reference for
# myself.
# assign arguments in constructor to properties of the same name:
class Thingie
constructor: (@name, @url) ->
# is the same as: