This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/bin/bash | |
| DB_USER=root | |
| DB_PASS="" | |
| HOST=localhost | |
| DBS_LIST=$(mysql -u $DB_USER $DB_PASS -Bse 'show databases') | |
| BASE_BAK_FLDR=/www/backups/dump | |
| RM_FLDR_DAYS="+7" | |
| index=0 | |
| PING=$(mysqladmin ping --host $HOST -u $DB_USER $DB_PASS 2>/dev/null) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/bin/bash | |
| export EC2_PRIVATE_KEY=~/.ec2/pk.pem | |
| export EC2_CERT=~/.ec2/cert.pem | |
| ec2-create-snapshot vol-ab0921c0 -d "Intellinar Server ROOT - $(date +'%d-%m-%Y')" | |
| ec2-create-snapshot vol-110d257a -d "Intellinar Data - $(date +'%d-%m-%Y')" | |
| ec2-create-snapshot vol-8bbb93e0 -d "Database Server aka RDS - $(date +'%d-%m-%Y')" | |
| Purge EBS Snapshots | |
| ------------------- | |
| export EC2_PRIVATE_KEY=~/.ec2/pk.pem |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/usr/bin/python | |
| from twython import Twython | |
| CONSUMER_KEY = 'XXXXXXXXXXXXXXXXXXXX' | |
| CONSUMER_SECRET = 'XXXXXXXXXXXXXXXXXXXXXXXXXXX' | |
| ACCESS_KEY = 'XXXXXXXXXXXX' | |
| ACCESS_SECRET = 'XXXXXXXXXXXXX' | |
| api = Twython(CONSUMER_KEY,CONSUMER_SECRET,ACCESS_KEY,ACCESS_SECRET) | |
| trends = [ ] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /* usbreset -- send a USB port reset to a USB device */ | |
| #include <stdio.h> | |
| #include <unistd.h> | |
| #include <fcntl.h> | |
| #include <errno.h> | |
| #include <sys/ioctl.h> | |
| #include <linux/usbdevice_fs.h> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| __author__ = 'mohsin' | |
| import boto.ec2 | |
| import optparse | |
| from termcolor import colored | |
| parser = optparse.OptionParser() | |
| parser.add_option("-r", action="count", dest="regions", help='list all regions') | |
| parser.add_option("-i", action="count", dest="instances", help='list all instances in region') | |
| parser.add_option("-a", action="count", dest="all_instances", help='list all instances in all region') |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| __author__ = 'mohsin' | |
| import base64 | |
| from Crypto.Cipher import DES3 | |
| secret = base64.decodestring('nMfNBx9y1T7Xe+DvWmsFwTeGUevEw3WLQlD5pl74qvo=') | |
| password = base64.decodestring('temWEHt1x/0=') | |
| print DES3.new(secret[:24], DES3.MODE_CBC, secret[24:]).decrypt(password) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import requests | |
| url = 'http://kitaabghar.com/bookbase/idara/KrishanChandKeBehtareenAfsanay.html' | |
| def download_file(url,path,filename=''): | |
| try: | |
| if filename=='': |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Patch for OpenSSH Portable to log passwords | |
| Tested on: | |
| OpenSSH 5.3p1 - OpenSSH 6.6p1 | |
| May apply to older versions. | |
| To apply: | |
| patch --dry-run < sshlog.patch |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/bin/bash | |
| HOST=localhost | |
| BASE_BAK_FLDR=/backup/mongodb | |
| RM_FLDR_DAYS="+7" | |
| DB_BKP_FLDR=$BASE_BAK_FLDR/$(date +%d-%m-%Y) | |
| [ ! -d $DB_BKP_FLDR ] && mkdir -p $DB_BKP_FLDR | |
| mongodump --host $HOST --out $DB_BKP_FLDR |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| set nocompatible | |
| filetype off | |
| set rtp+=~/.vim/bundle/Vundle.vim | |
| call vundle#begin() | |
| Plugin 'gmarik/Vundle.vim' | |
| Plugin 'tpope/vim-fugitive' | |
| Plugin 'mattn/webapi-vim' | |
| Plugin 'mattn/gist-vim' | |
| Plugin 'kien/ctrlp.vim' | |
| Plugin 'bling/vim-airline' |
OlderNewer