Skip to content

Instantly share code, notes, and snippets.

@kshwetabh
kshwetabh / JSHintTasks.xml
Created June 20, 2014 06:48
Ant based task to Lint the modified files with JSHint.
<?xml version="1.0" encoding="UTF-8"?>
<!-- @author Kumar Shwetabh, @version 1.0 -->
<!-- Based upon https://github.com/philmander/ant-jshint -->
<!-- Add reference to http://jslinterrors.com in the reports file -->
<project name="LintTasks" default="LintTasks" basedir=".">
<property name="FilesToLint" value="C:/LintFiles"/>
<property name="ReportFile" value="${basedir}/jshint/results.html"/>
<target name="LintTasks">
@kshwetabh
kshwetabh / .vimrc
Created February 18, 2012 18:05
My .vimrc configuration
"
" Kumar Shwetabh's Vim Configuration
"
" Features/Plugins Used
" 1. pathogen
" 2. NERDTree.
" 3. vim-coffee-script
" 4. conque
" 5. gundo
" 6. xpt
@kshwetabh
kshwetabh / GetRouterDHCPClientTable.py
Created May 13, 2012 22:32
A python snippet to retrieve the list of all the devices (computer, tablet, mobile, etc) connected currently with your router.
'''
Tested only with Linksys WRT54G Router. Not sure if it will work with other routers. You might need to modify the url and header according to your router.
I still need to further clean the output to retrieve the list/name of devices rather than complete HTML in the response.
'''
import urllib2
from BeautifulSoup import BeautifulSoup
url = 'http://192.168.1.1/DHCPTable.asp'
headers= {'Authorization':'Basic XXXXX-25_CHARACTER_TOKEN_GOES_HERE'}
@kshwetabh
kshwetabh / utils.ahk
Created December 21, 2012 16:05
Various AutoHotKey shortcut key combinations.
; Opens new appointment in Outlook, Win a
;*****************************************************************
#a:: Run C:\Program Files\Microsoft Office\Office12\OUTLOOK.EXE /c ipm.appointment
; Opens new task in Outlook, Win t
;*****************************************************************
#t:: Run C:\Program Files\Microsoft Office\Office12\OUTLOOK.EXE /c ipm.task
; Launches specified search in default browser on duckduckgo.com website, ;s
@kshwetabh
kshwetabh / BashTheCache.xml
Last active December 15, 2015 17:29
Ant Task to clear the Internet Explorer browser cache. Add this task to your ant build file and it will make sure to clear your browser cache on each build. Might be handy if you need to build your UI code (JS/JSP, etc) to copy to deploy directory after editing the source.
<target name="CleanIECache">
<echo>Clearing browser cache...</echo>
<exec executable="C:\Windows\System32\rundll32.exe">
<arg value="InetCpl.cpl,"/>
<arg value="ClearMyTracksByProcess"/>
<arg value="8"/>
</exec>
</target>
<!--
@kshwetabh
kshwetabh / youtube-dl
Last active December 18, 2015 07:08
Notes on Youtube.dl tool
1. Install
sudo apt-get install youtube-dl
sudo apt-get install libavcodec-extra-53
2. Download video
-Single video
youtube-dl -f 18 <URL>
-Batch
youtube-dl -a filename.txt
3. Check all supported video formats for a youtube video
youtube-dl -F <URL>
@kshwetabh
kshwetabh / gif_creator
Created July 10, 2013 01:16
Handy tool and commands to generate gif images from jpeg files in Linux
Required package/software:
sudo apt-get install imagemagick
Resize your .jpg images to a smaller size, such as 640×480 by using the following command:
mogrify -resize 640x480 *.jpg
Use the command below to create an animated gif of your jpg images
convert -delay 20 -loop 0 *.jpg myimage.gif
@kshwetabh
kshwetabh / Cross Browser Issues
Last active December 26, 2015 23:49
This gist aims to collect as many inconsistencies as possible related to the cross-browser compatibility issues. They may be related to javascript, css, DOM etc.
1. A text node in Firefox allows only 4K data. So an XML Ajax response gets split up into multiple text child nodes instead of only one node. Its fine in Internet Explorer. For Firefox, to get the full data you either need to use node.normalize before you call node.firstChild or use node.textContent, both of which are Mozilla specific methods
2. Internet Explorer does not replace &nbsp; or HTML char code 160, you need to replace its Unicode equivalent \u00a0
3. In Firefox a dynamically created input field inside a form (created using document.createElement) does not pass its value on form submit.
4. document.getElementById in Internet Explorer will return an element even if the element name matches. Mozilla only returns element if id matches.
5. In Internet Explorer if a select box has a value not represented by any of the options, it will display blank, Firefox displays the first option.
@kshwetabh
kshwetabh / python_resources.md
Created November 11, 2013 18:22 — forked from jookyboi/python_resources.md
Python-related modules and guides.

Packages

  • lxml - Pythonic binding for the C libraries libxml2 and libxslt.
  • boto - Python interface to Amazon Web Services
  • Django - Django is a high-level Python Web framework that encourages rapid development and clean, pragmatic design.
  • Fabric - Library and command-line tool for streamlining the use of SSH for application deployment or systems administration task.
  • PyMongo - Tools for working with MongoDB, and is the recommended way to work with MongoDB from Python.
  • Celery - Task queue to distribute work across threads or machines.
  • pytz - pytz brings the Olson tz database into Python. This library allows accurate and cross platform timezone calculations using Python 2.4 or higher.

Guides

@kshwetabh
kshwetabh / javascript_resources.md
Created November 11, 2013 18:22 — forked from jookyboi/javascript_resources.md
Here are a set of libraries, plugins and guides which may be useful to your Javascript coding.

Libraries

  • jQuery - The de-facto library for the modern age. It makes things like HTML document traversal and manipulation, event handling, animation, and Ajax much simpler with an easy-to-use API that works across a multitude of browsers.
  • Backbone - Backbone.js gives structure to web applications by providing models with key-value binding and custom events, collections with a rich API of enumerable functions, views with declarative event handling, and connects it all to your existing API over a RESTful JSON interface.
  • AngularJS - Conventions based MVC framework for HTML5 apps.
  • Underscore - Underscore is a utility-belt library for JavaScript that provides a lot of the functional programming support that you would expect in Prototype.js (or Ruby), but without extending any of the built-in JavaScript objects.
  • lawnchair - Key/value store adapter for indexdb, localStorage