Skip to content

Instantly share code, notes, and snippets.

View tuxdna's full-sized avatar

Saleem Ansari tuxdna

View GitHub Profile
#!/bin/sh
# Copyright (C) and Author:
# Saleem Ansari <tuxdna@gmail.com>
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version. See
# http://www.gnu.org/copyleft/gpl.html for the full text of the
@tuxdna
tuxdna / gist:866497
Created March 11, 2011 20:20
Search Wikipedia
searchWk() {
wget -O- "http://en.wikipedia.org/w/api.php?action=opensearch&search=$1" 2>/dev/null ;
echo;
}
wikipediaSearch() {
echo -n -e "\n============================================\n\tWelcome to WikiPedia Search"; echo ""; i=1 ; for line in $(lynx --dump "http://www.google.co.in/search?q=$1+site%3Awikipedia.org" | grep http://en.wikipedia.org/wiki | cut -c7-); do echo $i $line; lines[$i]=$line ; i=$(($i+1)); done ; echo -n -e "\n============================================\n\tPlease select the link to open - "; read answer; w3m ${lines[$answer]}
}
@tuxdna
tuxdna / gist:912652
Created April 10, 2011 19:46
Web Authentication and Authorization
How does Open ID work?
http://wiki.openid.net/w/page/12995171/Introduction
How does Open Auth work?
http://tools.ietf.org/html/rfc5849
http://nikhilvishnu.com/2010/04/05/understanding-oauth-open-authorization/
What is the difference b/w OpenAuth and OpenID ?
http://softwareas.com/oauth-openid-youre-barking-up-the-wrong-tree-if-you-think-theyre-the-same-thing
@tuxdna
tuxdna / japanesename.py
Created July 22, 2011 21:08
Convert your name to Japanese
jmap = {
"A": "ka",
"B": "tu",
"C": "mi",
"D": "te",
"E": "ku",
"F": "lu",
"G": "ji",
"H": "ri",
"I": "ki",
Sep 19 18:00:57 * vaidik (75d35d4a@gateway/web/freenode/ip.117.211.93.74) has joined #fedora-websites
Sep 19 18:01:13 <vaidik> tuxdna: hi
Sep 19 18:02:18 <tuxdna> vaidik, hi!
Sep 19 18:02:36 schendje shaiton Shrink sijis Sonar_Gal sonar_logger2
Sep 19 18:02:40 <tuxdna> Shrink, hi
Sep 19 18:02:49 <Shrink> hi
Sep 19 18:03:15 * underscores has quit (Ping timeout: 258 seconds)
Sep 19 18:03:31 <tuxdna> vaidik, Shrink: I guess all of us have read the discussion on the mailing list.
Sep 19 18:03:44 <Shrink> I guess
Sep 19 18:04:45 <tuxdna> vaidik, you mentioned about FAS account. I think it also supports OpenID. Shrink do you have an idea if we can use FAS as OpenID ?
@tuxdna
tuxdna / photon.sh
Created October 10, 2011 20:55
Tata Photon Prepaid dongle on Fedora 14
D="201e:2009"
echo "Searching for device: $D"
lsusb | grep "$D"
retval=$?
if [ $retval != 0 ]
then
echo "Device not found in 'lsusb' listing"
exit $retval
else
@tuxdna
tuxdna / photon.sh
Created October 10, 2011 21:00 — forked from tuxdna/photon.sh
Tata Photon Prepaid dongle on Fedora 14
D="201e:2009"
echo "Searching for device: $D"
lsusb | grep "$D"
retval=$?
if [ $retval != 0 ]
then
echo "Device not found in 'lsusb' listing"
exit $retval
else
@tuxdna
tuxdna / multidisplay.sh
Created November 17, 2011 14:36
Script to enable multiple monitors using Xrandr
#!/bin/sh
# Author: siddhesh.in
# Here’s a script I’ve written to do this with any external display (monitor, projector, etc.).
# Execute it after connecting the display to your box:
typeset -a resx
typeset -a resy
typeset -a screen
typeset -i name=1
typeset -i count=0
@tuxdna
tuxdna / gist:1510138
Created December 22, 2011 12:27
Find empty directories
find . -type d | ruby -ne 'chomp! ; puts $_ if Dir.entries($_).delete_if {|f| %w{. ..}.include?(f) }.length == 0'