Skip to content

Instantly share code, notes, and snippets.

View abdul's full-sized avatar
🎯
Focusing

Abdul Qabiz abdul

🎯
Focusing
View GitHub Profile
@abdul
abdul / strict_bucket_policy.json
Created September 16, 2016 17:47
AWS IAM - Strict Bucket only policy - No BucketListing
{
"Statement": [
{
"Effect": "Deny",
"Action": [
"s3:*"
],
"NotResource": [
"arn:aws:s3:::<bucket>",
"arn:aws:s3:::<bucket>/*"
@abdul
abdul / bucket_policy.json
Created September 16, 2016 17:45
AWS IAM Policy to allow Bucket only access
{
"Statement": [
{
"Effect": "Allow",
"Action": [
"s3:*"
],
"Resource": [
"arn:aws:s3:::<bucket/prefix>",
"arn:aws:s3:::<bucket/prefix>/*"
@abdul
abdul / recreate_magento_indexer_tables.sql
Created September 16, 2016 17:39
Recreate Magento Index (Indexer) Tables
DROP TABLE IF EXISTS `index_process_event`;
DROP TABLE IF EXISTS `index_event`;
DROP TABLE IF EXISTS `index_process`;
CREATE TABLE `index_event` (
`event_id` BIGINT(20) UNSIGNED NOT NULL AUTO_INCREMENT,
`type` VARCHAR(64) NOT NULL,
@abdul
abdul / run-command-on-directory.sh
Created September 16, 2016 17:35
Run Bash command on all files in a directory
for file in /Users/xyz/Desktop/my-dir/*; do echo "hello $file" >> results.out; done
@abdul
abdul / http-check.conf
Created September 16, 2016 17:32
monit http check
## http-check
check program http-check with path "/etc/monit/http-check.sh"
start program = "/etc/init.d/php5-fpm start"
stop program = "/etc/init.d/php5-fpm stop"
if status !=0 then alert
if status !=0 then restart
if 5 restarts within 5 cycles then timeout
@abdul
abdul / teamcity.conf
Created September 4, 2016 09:54
Teamcity (with WebSockets) - Nginx with SSL
map $http_upgrade $connection_upgrade {
default upgrade;
'' '';
}
server {
listen 80;
server_name teamcity.local;
rewrite ^ https://$host$request_uri? permanent;
@abdul
abdul / Update remote repo
Created August 7, 2016 07:56 — forked from mandiwise/Update remote repo
Transfer repo from Bitbucket to Github
// Reference: http://www.blackdogfoundry.com/blog/moving-repository-from-bitbucket-to-github/
// See also: http://www.paulund.co.uk/change-url-of-git-repository
$ cd $HOME/Code/repo-directory
$ git remote rename origin bitbucket
$ git remote add origin https://github.com/mandiwise/awesome-new-repo.git
$ git push origin master
$ git remote rm bitbucket
@abdul
abdul / ratelimit.nginxconf
Created July 21, 2016 14:57 — forked from ipmb/ratelimit.nginxconf
Nginx reverse proxy with rate limiting
upstream myapp {
server 127.0.0.1:8081;
}
limit_req_zone $binary_remote_addr zone=login:10m rate=1r/s;
server {
listen 443 ssl spdy;
server_name _;
@abdul
abdul / tuning_nginx_nodejs
Created July 20, 2016 11:44 — 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.
#!/bin/bash
#
# MongoDB Backup Script
# VER. 0.1
# Note, this is a lobotomized port of AutoMySQLBackup
# (http://sourceforge.net/projects/automysqlbackup/) for use with
# MongoDB.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by