Skip to content

Instantly share code, notes, and snippets.

@kshwetabh
kshwetabh / CurrentWeatherWall.py
Created January 8, 2012 20:52
Change Wallpaper based on current weather condition
import os
import pywapi
import string
'''
CurrentWeatherWall
Set you desektop wallpaper as per the current weather condition
OS: Ubuntu {I have tested on Ubuntu 11.10}
See the import statements for Python module dependencies
@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 / GMailReminder.gs
Created February 11, 2013 02:09
Reminder script for GMail: A simple Google Apps Script to create a Google Calendar event (reminder) for any mail (with a specific label). You can then setup ("timed") triggers in Apps Script... (public version of the GMailReminder gist)
/**
* Reminder script for GMail: A simple Google Apps Script to create a Google Calendar event (reminder) for any mail (with a
* specific label). You can then setup ("timed") triggers in Apps Script (hourly, etc) to monitor your Inbox.
* How to Use:
* 1. Log into Google Drive account and create a Google Script.
* 2. Copy and paste the below snippet into the gs file.
* 3. Make sure to update the 'reminderLabel', 'calendarName' and 'reminderDuration' as per your preference.
* 4. Test the script to make sure it is working properly.
* 5. Setup a time-driven Project Trigger (hourly, etc) to automatically run this script and create calendar events.
*
@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 / 0_reuse_code.js
Created November 11, 2013 18:22
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console