Skip to content

Instantly share code, notes, and snippets.

@swarajgiri
swarajgiri / git alias
Last active April 26, 2017 11:04
git alias
[alias]
cp = cherry-pick
st = status
cl = clone
ci = commit
co = checkout
br = branch
diff = diff --word-diff
dc = diff --cached
unstage = reset HEAD --
@swarajgiri
swarajgiri / backup.js
Created September 11, 2014 09:41
Mongo db back up
var shell = require('shelljs'),
cfg = require('./cfg'),
DSS = require('distack'),
co = require('co'),
filestore = new DSS(cfg.storestack);
require('datejs');
var backupName = new Date().toString('yyyy-MM-dd-HH-mm') + '.tar.gz';
LogFormat "{ \
\"@vips\":[\"%v\"], \
\"@source\":\"%v%U%q\", \
\"@source_host\": \"%v\", \
\"@source_path\": \"%f\", \
\"@tags\":[\"Apache\",\"Access\"], \
\"@message\": \"%h %l %u %t \\\"%r\\\" %>s %b\", \
\"@fields\": { \
\"timestamp\": \"%{%Y-%m-%dT%H:%M:%S%z}t\", \
\"clientip\": \"%a\", \
@swarajgiri
swarajgiri / logstash.conf
Last active August 29, 2015 14:15
Logstash conf
input {
lumberjack {
port => 5104
type => "apache_json"
codec => "json"
ssl_certificate => "/etc/pki/tls/certs/logstash-forwarder.crt"
ssl_key => "/etc/pki/tls/private/logstash-forwarder.key"
}
lumberjack {
@swarajgiri
swarajgiri / nginx.conf
Last active August 29, 2015 14:17 — forked from plentz/nginx.conf
# to generate your dhparam.pem file, run in the terminal
openssl dhparam -out /etc/nginx/ssl/dhparam.pem 2048
@swarajgiri
swarajgiri / deploy.sh
Created March 24, 2015 05:55
Laravel deployment opti
#!/bin/bash
PATH=/usr/bin:/bin/:/usr/bin/php
php artisan clear-compiled
php artisan config:clear
php artisan cache:clear
php artisan route:clear
php artisan optimize
php artisan config:cache
php artisan route:cache
{
"title": "Apache and Tomcat Logs",
"services": {
"query": {
"list": {
"0": {
"query": "apache !tomcat !static",
"alias": "",
"color": "#7EB26D",
"id": 0,
// Node.js CheatSheet.
// Download the Node.js source code or a pre-built installer for your platform, and start developing today.
// Download: http://nodejs.org/download/
// More: http://nodejs.org/api/all.html
// 0. Synopsis.
// http://nodejs.org/api/synopsis.html
http {
proxy_cache_path /var/cache/nginx levels=1:2 keys_zone=one:8m max_size=3000m inactive=600m;
proxy_temp_path /var/tmp;
include mime.types;
default_type application/octet-stream;
sendfile on;
keepalive_timeout 65;
gzip on;
gzip_comp_level 6;
function mySexyMethod() {
return new Promise(function (resolve, reject) {
someAsync.method(params, function (err, data) {
if (err) {
return reject(err);
}
resolve(data);
})
});