Skip to content

Instantly share code, notes, and snippets.

View fizerkhan's full-sized avatar

Fizer Khan (பைசர் கான்) fizerkhan

View GitHub Profile
@fizerkhan
fizerkhan / IAM_Policy.json
Last active August 29, 2015 14:20
What IAM policy do I need for S3 backups?
{
"Version": "2012-10-17",
"Statement":[
{
"Effect":"Allow",
"Action":"s3:*",
"Resource":[
"arn:aws:s3:::BUCKET_NAME",
"arn:aws:s3:::BUCKET_NAME/*"
]
@fizerkhan
fizerkhan / beacon.js
Last active August 29, 2015 14:19 — forked from ruturajv/beacon.js
http = require('http');
url = require('url');
http.createServer(function(req, res){
var requestURL = url.parse(req.url, true)['pathname'];
if (requestURL == '/log.gif') {
var imgHex = '47494638396101000100800000dbdfef00000021f90401000000002c00000000010001000002024401003b';
var imgBinary = new Buffer(imgHex, 'hex');
res.writeHead(200, {'Content-Type': 'image/gif' });
@fizerkhan
fizerkhan / how_nodejs_works.md
Created April 23, 2015 14:08
How NodeJS works?

Node.JS

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;
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;
@fizerkhan
fizerkhan / dokku-node-mongo.md
Last active March 12, 2019 17:44
NodeJS and MongoDB app in Dokku with Digital Ocean

Steps:

  1. Create Digital Ocean Droplet with Dokku v0.3.16 on 14.04 image

  2. Login into the droplet and Update local settings.

    sh -c "echo 'LANG=en_US.UTF-8\nLC_ALL=en_US.UTF-8' > /etc/default/locale"
    reboot
@fizerkhan
fizerkhan / dokku-mongodb.md
Last active August 29, 2015 14:18
MongoDB auth issue in Dokku

When i run MongoDB dokku plugin, it does not work with my NodeJS app. Also dokku mongodb:list does not work. It throws MongoError: auth failed docker

It can be fixed by setting proper locals:

 sh -c "echo 'LANG=en_US.UTF-8\nLC_ALL=en_US.UTF-8' > /etc/default/locale"
@fizerkhan
fizerkhan / hosts
Created April 1, 2015 13:33
Ansible variable procedence
[servers]
127.0.0.1
@fizerkhan
fizerkhan / gist:41f9c525db5b3b16bfcb
Last active March 28, 2023 19:54
RSA Host Key has been changed.

Solution for RSA host key for <ip_address> has changed and you have requested strict checking:

Method 1: Remove keys

ssh-keygen -R <server_name>

(or)

ssh-keygen -R

@fizerkhan
fizerkhan / state-data.js
Created March 31, 2015 11:42
HighChart California data
[{
"path": ["M", 2557, -685, "L", 2607, -645, 2476, -658, 2556, -706, 2557, -685, "M", 3394, -1662, "L", 3403, -1662, 3423, -1662, 3428, -1152, 3397, -1056, 3314, -1104, 3263, -1110, 3177, -1080, 3101, -1104, 3015, -1092, 2890, -1153, 2772, -1166, 2621, -1161, 2450, -1140, 2415, -1221, 2309, -1257, 2284, -1295, 2327, -1431, 2292, -1493, 2315, -1607, 2261, -1664, 2282, -1742, 2298, -1723, 2428, -1762, 2485, -1754, 2611, -1662, 2611, -1728, 2580, -1777, 2718, -1805, 2737, -1856, 2804, -1896, 2914, -1837, 2963, -1840, 3136, -1742, 3204, -1743, 3334, -1657, 3394, -1662, "M", 2763, -652, "L", 2861, -657, 2869, -613, 2921, -606, 2903, -558, 2797, -502, 2734, -535, 2665, -625, 2763, -652, "M", 3170, -580, "L", 3045, -588, 2980, -716, 3059, -699, 3177, -675, 3252, -643, 3317, -692, 3358, -668, 3322, -622, 3229, -611, 3170, -580, "Z"],
"name": "Santa Barbara",
"properties": {
"hc-group": "admin2",
"hc-middle-x": 0.51,
"hc-middle-y": 0.29,
"hc-key": "us-ca-083",
"hc-a