Skip to content

Instantly share code, notes, and snippets.

@mehulved
mehulved / gspell.py
Created March 24, 2012 20:46
Spell Checking with Google
#!/usr/bin/env python
import requests
import sys
url = "https://www.google.com/tbproxy/spell?lang=en:"
word = sys.argv[1]
xml_struct = """
<spellrequest textalreadyclipped="0" ignoredups="0" ignoredigits="1" ignoreallcaps="1">
@mehulved
mehulved / change-pass
Created May 1, 2012 07:07
Change password for all the users in the system
#!/usr/bin/env bash
PASS="mypass"
for USER in `awk -F: '{print $1}' /etc/passwd`
do
echo $USER:$PASS >> user_list
done
cat user_list | chpasswd
@mehulved
mehulved / populate-offlineimaprc
Created May 2, 2012 08:23
This script will add users to offlineimaprc file for syncing emails
#!/usr/bin/python
userfile = open('/etc/passwd', 'r')
rcfile = open('~/.offlineimaprc','w')
entries = userfile.read().split("\n")
userfile.close()
userlist = []
content_repos = ""
@mehulved
mehulved / serialEvent
Created May 2, 2012 12:38
Goes to high but doesn't return back to low
int led = 13;
char ledValue;
void setup() {
Serial.begin(9600);
Serial.println("Enter H to turn on the LED and L to turn it off");
}
void loop() {
Serial.println(digitalRead(led));
delay(1000);
@mehulved
mehulved / uastring.py
Created August 1, 2012 18:34
User Agent strings in more usable format
def uastring(platforms, format):
'''
This function is used to retrive User Agent String for various browsers/platforms from www.useragentstring.com.
Aim of this module is to simplify using the available data.
To find the value of the platform, visit http://useragentstring.com and get the part after /pages/
The platform parameter should be a set of one or more platforms. Supported formats are csv, json and xml.
'''
import requests
import BeautifulSoup as bsoup
$ foreman start
14:41:56 web.1 | started with pid 29117
14:41:58 web.1 | 2013-08-12 14:41:58 [29120] [INFO] Starting gunicorn 17.5
14:41:58 web.1 | 2013-08-12 14:41:58 [29120] [INFO] Listening at: http://0.0.0.0:5000 (29120)
14:41:58 web.1 | 2013-08-12 14:41:58 [29120] [INFO] Using worker: sync
14:41:58 web.1 | 2013-08-12 14:41:58 [29130] [INFO] Booting worker with pid: 29130
14:42:04 web.1 | Did not find settings file development.py
14:42:04 web.1 | /home/mehul/Projects/funnel/venv/local/lib/python2.7/site-packages/flask_cache/__init__.py:100: UserWarning: Flask-Cache: CACHE_TYPE is set to null, caching is effectively disabled.
14:42:04 web.1 | warnings.warn("Flask-Cache: CACHE_TYPE is set to null, "
14:42:04 web.1 | * Running on http://0.0.0.0:3000/
---
- name: Prepare hosts that will be used
user: root
hosts: all
roles:
- name: Gather information about all the hosts in our account
local_action:
module: rax_facts
credentials: ~/.rackspace_cloud_credentials
name: "{{ inventory_hostname }}"
import MySQLdb
# MySQL Connection Parameters
MYSQL_USER=''
MYSQL_PASSWORD=''
MYSQL_DB=''
MYSQL_HOST=''
# Collation Information
OLD_COLLATION=''
@mehulved
mehulved / gist:fcf7bc472a4a62f73557
Created January 9, 2015 10:42
Keybase Github Identity
### Keybase proof
I hereby claim:
* I am mehulved on github.
* I am mved (https://keybase.io/mved) on keybase.
* I have a public key whose fingerprint is 00A3 54FD 9C58 207D 8788 6176 82F3 C99F 4B53 9199
To claim this, I am signing this object:
GitHub pull request #5 of commit 7f528913d419bd6af5313e48067a7afc9801ea3f, no merge conflicts.
Setting status of 7f528913d419bd6af5313e48067a7afc9801ea3f to PENDING with url http://devops.deltamktgresearch.com/jenkins/job/VRPTestPullRequest/26/ and message: 'Build started sha1 is merged.'
Building in workspace /var/lib/jenkins/jobs/VRPTestPullRequest/workspace
> git rev-parse --is-inside-work-tree # timeout=10
Fetching changes from the remote Git repository
> git config remote.origin.url https://github.com/nexsalesdev/VRPTF.git # timeout=10
Fetching upstream changes from https://github.com/nexsalesdev/VRPTF.git
> git --version # timeout=10
using .gitcredentials to set credentials
> git config --local credential.username nexsalesdev # timeout=10