Skip to content

Instantly share code, notes, and snippets.

View abdul's full-sized avatar
🎯
Focusing

Abdul Qabiz abdul

🎯
Focusing
View GitHub Profile
git branch -r | awk '{print $1}' | egrep -v -f /dev/fd/0 <(git branch -vv | grep origin) | awk '{print $1}' | xargs git branch -d
@abdul
abdul / docker_clean_all_images.sh
Created September 16, 2016 17:55
Useful Docker Commands
docker rmi $(docker images -q)
@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 _;