Skip to content

Instantly share code, notes, and snippets.

View ankibalyan's full-sized avatar

Ankit Balyan ankibalyan

View GitHub Profile
You can delete the lock file with the following command:
sudo rm /var/lib/apt/lists/lock
You may also need to delete the lock file in the cache directory
sudo rm /var/cache/apt/archives/lock
sudo dpkg --configure -a
Set Up PHP Development Evnviroment
Host Machine: Linux Ubuntu
Download From
http://releases.ubuntu.com/14.04.3/ubuntu-14.04.3-desktop-amd64.iso
editor/IDE: Sublime
Download From
http://c758482.r82.cf2.rackcdn.com/sublime-text_build-3083_amd64.deb
@ankibalyan
ankibalyan / excel_libs.txt
Last active February 6, 2016 09:13
Read/write Excel Lib Notes
https://github.com/PHPOffice/PHPExcel
http://pear.php.net/package/Spreadsheet_Excel_Writer/
https://github.com/iliaal/php_excel
http://code.google.com/p/php-excel/
https://github.com/elidickinson/php-export-data
#Install Ubuntu Linux, nginx, MySQL, PHP 7.0 (LEMP) stack
#nginx
sudo apt-get update && sudo apt-get upgrade
sudo apt-get install nginx
sudo apt-get update
check localhost or server ip address
"welcome message by nginx"
To stop your web server, you can type:
import { Meteor } from 'meteor/meteor';
import { Accounts } from 'meteor/accounts-base';
import { FilesCollection } from 'meteor/ostrio:files';
import * as fs from 'fs';
import multer from 'multer';
export const Avatars = new FilesCollection({
collectionName: 'avatars',
allowClientCode: false,
onBeforeUpload: function (file) {
@ankibalyan
ankibalyan / mongodb.md
Created December 16, 2016 05:40
#mongodb cheat sheet

MongoDB cheat sheet

Overview

Overview

MongoDB is a document database that provides high performance, high availability, and easy scalability.

  • Document Database
@ankibalyan
ankibalyan / tuning_nginx_nodejs
Created December 16, 2016 13:04 — forked from carlessistare/tuning_nginx_nodejs
Tuning Nginx for heavy loading with nodejs as upstream. Short requests and a lot of concurrence.
# This number should be, at maximum, the number of CPU cores on your system.
# (since nginx doesn't benefit from more than one worker per CPU.)
worker_processes 8;
# Determines how many clients will be served by each worker process.
# (Max clients = worker_connections * worker_processes)
# "Max clients" is also limited by the number of socket connections available on the system (~64k)
# run ss -s and u'll see a timewait param
# The reason for TIMED_WAIT is to handle the case of packets arriving after the socket is closed.
@ankibalyan
ankibalyan / post-receive
Created June 20, 2017 07:23
Git push to deploy post receve script
#!/bin/bash
target_branch="production"
working_tree="PATH_TO_DEPLOY"
while read oldrev newrev refname
do
branch=$(git rev-parse --symbolic --abbrev-ref $refname)
if [ -n "$branch" ] && [ "$target_branch" == "$branch" ]; then
@ankibalyan
ankibalyan / ubuntu upstart service
Created June 20, 2017 17:01
Upstart service for ubuntu that starts automatically on system restarts, and restarts on failure
#! /etc/systemd/system/name.service
[Unit]
Description==describe you upstart service
# if mysql service is prerequisite
Requires=mysql.service
After=mysql.service
# if anyother service is prerequisite