Skip to content

Instantly share code, notes, and snippets.

@mahmoodkhan
mahmoodkhan / google_spreadsheet.py
Last active August 29, 2015 14:13
Exporting data to Google Spreadsheet using gdata.spreadsheets.client and gdata.gauth.OAuth2Token
from silo.models import Silo, DataField, ValueStore
from django.contrib.auth.decorators import login_required
import json as simplejson
from django.template import RequestContext
from django.contrib.auth.models import User
from django.http import HttpResponseRedirect, HttpResponseBadRequest, HttpResponse
from django.shortcuts import render_to_response, get_object_or_404, redirect, render
@mahmoodkhan
mahmoodkhan / google_spreadsheet2.py
Created January 27, 2015 01:28
google spreadsheet djagno api spreadsheet_api oauth
from oauth2client.client import flow_from_clientsecrets
from oauth2client.django_orm import Storage
from oauth2client import xsrfutil
from django.conf import settings
from django.views.decorators.csrf import csrf_protect
from .models import GoogleCredentialsModel
from apiclient.discovery import build
import os, logging, httplib2, json, datetime
import gdata.spreadsheets.client
@mahmoodkhan
mahmoodkhan / python_gsheet_import.py
Last active March 11, 2016 22:54
importing data from google spreadsheets api using gdata python api and oatuh2.0
import os, logging, httplib2, json, datetime
from django.core.urlresolvers import reverse
from django.http import HttpResponseRedirect, HttpResponseBadRequest, JsonResponse
from django.contrib import messages
from django.contrib.auth.decorators import login_required
from django.contrib.auth.models import User
from django.utils import timezone
@mahmoodkhan
mahmoodkhan / mysql_db_reset.sh
Last active May 6, 2016 16:33
Shell script for dumping and creating a MySQL databae and loading Django fixtures
#!/bin/bash
# Ths script drops a MySQL db if it already exists and then creates a MySQL db with username/password.
# The script can belled as:
# . mysql_db_reset.sh testdb testuser secretpass
#
BTICK='`'
EXPECTED_ARGS=3
E_BADARGS=65
MYSQL=`which mysql`
@mahmoodkhan
mahmoodkhan / Sublime Text 3
Last active April 8, 2017 12:40
Sublime Text 3 handy shortcuts
Sublime Text 3 - Handy Shortcuts
=================================
Open/Goto
_________
- command+t: go to file
- command+ctrl+p: go to project
- command+r: go to methods
- command+shift+p: command prompt
- ctrl+g: go to line
function pagination(c, m) {
var current = c,
last = m,
delta = 2,
left = current - delta,
right = current + delta + 1,
range = [],
rangeWithDots = [],
l;
@mahmoodkhan
mahmoodkhan / mysql_backup.sh
Created January 30, 2018 15:12 — forked from tleish/mysql_backup.sh
Bash Script to backup all MySQL databases
#!/bin/bash
#==============================================================================
#TITLE: mysql_backup.sh
#DESCRIPTION: script for automating the daily mysql backups on development computer
#AUTHOR: tleish
#DATE: 2013-12-20
#VERSION: 0.4
#USAGE: ./mysql_backup.sh
#CRON:
# example cron for daily db backup @ 9:15 am

Keybase proof

I hereby claim:

  • I am mahmoodkhan on github.
  • I am mkhan (https://keybase.io/mkhan) on keybase.
  • I have a public key ASDkwIHI0MSZSNTY7xpOFgHWqqXXe9k2XMeh-oJknn6IDAo

To claim this, I am signing this object:

@mahmoodkhan
mahmoodkhan / keybindings.json
Created October 20, 2019 02:43
VS Code settings and keybindings
// The location o this file: ~/Library/Application Support/Code/User/keybindings.json
[
{
"key": "cmd+\\",
"command": "workbench.action.toggleSidebarVisibility"
},
{
"key": "cmd+b",
"command": "-workbench.action.toggleSidebarVisibility"
},

tmux cheatsheet

As configured in my dotfiles.

start new:

tmux

start new with session name: