Archive

Archive for the ‘Uncategorized’ Category

Moving my Blog

April 24, 2011 Leave a comment

After nearly 2 years of inactivity I have decided to resume the work on my blog and this time i have bought hosting.

Please bookmark the new link http://djsh.net

Categories: Uncategorized

Python GMail SMTP Send Email Script

April 8, 2009 7 comments

Here is a small script that i made some time ago , it uses GMail’s mail servers to send an email.

#!/usr/bin/python
# PyGms 1.0
# Gmail SMTP  Script Made by Djays


import smtplib
from email.MIMEMultipart import MIMEMultipart
from email.MIMEBase import MIMEBase
from email.MIMEText import MIMEText
from email import Encoders
import os

ver = "v1.0"
gmail_user = ""	#Username
gmail_pwd  = ""		#Password
gmail_alt  = " "		#Alias ID
gmail_alias = ""+gmail_alt		#nickname
mailing_list = ""
class mailz:
  def __init__(self):
    self.files=[""]
    self.mail = MIMEMultipart()

  def attach(self,fil):
    self.files.append(fil)

  def mailprep(self,to, subject, text):
    self.to = to
    self.mail['From'] = gmail_alias
    self.mail['To'] = to
    self.mail['Subject'] = subject
    if (mailtoBcc !="") :
      self.mail['BCC'] = mailtoBcc

    text+="\n\n\n_________________________\nMail generated By  PyGmS "+ver+"\n       - Made By Djays\n        http://djsh.net"

    self.mail.attach(MIMEText(text))
    print self.files

    for attach in self.files:
      if (attach != "") :
          part = MIMEBase('application', 'octet-stream')
          part.set_payload(open(attach, 'rb').read())
          Encoders.encode_base64(part)
          part.add_header('Content-Disposition','attachment; filename="%s"' % os.path.basename(attach))
          self.mail.attach(part)

  def sendmail(self):
    self.mailServer = smtplib.SMTP("smtp.gmail.com", 587)
    self.mailServer.ehlo()
    self.mailServer.starttls()
    self.mailServer.ehlo()
    self.mailServer.login(gmail_user, gmail_pwd)
    self.mailServer.sendmail(gmail_user, self.to, self.mail.as_string())
    self.mailServer.close()

mailto   =  raw_input("Enter Recepients (Seperated By a Comma): ")
mailtoBcc=  raw_input("Enter BCCRecepients (Seperated By a Comma): ")
mailsubj =  raw_input("Enter Subject: ")
mailmsg  =  raw_input("Enter Message: ")
mailattch = ""
newmail  = mailz()

while 1:
 mailattch = ""
 c = raw_input("Attach a File ? (y/n)")
 if c == 'n':
   break
 if c != 'y':
   continue
 mailattch = raw_input("Enter Path of file: ")
 newmail.attach(mailattch)
newmail.mailprep(mailto,mailsubj,mailmsg)

newmail.sendmail()
Categories: Uncategorized

Get updates of completed torrents via SMS Part 2

April 8, 2009 2 comments

The other day one of my friends Ankur , made a python script to get updates via sms using twitter account.
Check here :http://tinyurl.com/djbnon

I have changed the script to use Gmail SMTP instead .
Enjoy

import dbus,base64,urllib2,urllib
from dbus.mainloop.glib import DBusGMainLoop
import smtplib
from email.MIMEMultipart import MIMEMultipart
from email.MIMEText import MIMEText
from email import Encoders
import os

ver = "v1.0"
gmail_user = ""				                #Gmail Username

gmail_pwd  = ""					#Gmail Password
gmail_alias=" "+gmail_user                       #Gmail Nickname
gateway=""	# Check http://tinyurl.com/d5ghcv

def mailz(text):

    mail = MIMEMultipart()
    mail['From'] = gmail_alias

    mail['To'] = gateway
    mail.attach(MIMEText(text))
    mailServer = smtplib.SMTP("smtp.gmail.com", 587)
    mailServer.ehlo()
    mailServer.starttls()
    mailServer.ehlo()
    mailServer.login(gmail_user, gmail_pwd)
    mailServer.sendmail(gmail_user, gateway, mail.as_string())
    mailServer.close()

DBusGMainLoop(set_as_default=True)

s = dbus.SessionBus()
kt = s.get_object("org.ktorrent.ktorrent","/core")

def update(k):
        torrent = s.get_object("org.ktorrent.ktorrent","/torrent/"+k)
        name = torrent.get_dbus_method("name","org.ktorrent.torrent")
        mailz("ktorrent: finished " +name())

kt.connect_to_signal("finished",update)

import gobject
loop = gobject.MainLoop()
loop.run()
Categories: Uncategorized

Fedora 10 Fglrx

January 26, 2009 2 comments

Finally the RPMFusion Stable NonFree Updates repositories have the fglrx driver
All steps are to be executed in root/super-user mode

1) Get RPMFusion Repos.

rpm -Uvh http://download1.rpmfusion.org/nonfree/fedora/rpmfusion-nonfree-release-stable.noarch.rpm http://download1.rpmfusion.org/free/fedora/rpmfusion-free-release-stable.noarch.rpm

2) Install Fglrx

yum  install akmod-fglrx xorg-x11-drv-fglrx xorg-x11-drv-fglrx-libs -y

3) Blacklist radeon
Add

blacklist radeon

to /etc/modprobe.d/blacklist

4) Reboot

5) Make initrd

– While booting at grub press ‘e’ in line starting with kernel. Add ‘single’ to the end. Press ‘ESC’ & press ‘b’

cd /boot/
rm initrd-`uname -r`.img
mkinitrd initrd-`uname -r`.img `uname -r` --with=fglrx

6)Reboot

NOTE: You might have to do

aticonfig --initial -f
Categories: Uncategorized

Install fglrx from rpmfusion testing repos

December 30, 2008 Leave a comment

Now the fglrx driver is available in testing repos it can be installed .Since its in testing repos it is not recommended.
Older Guide: http://fglrx.djsh.net Older Guide’s Install Script: http://installfglrx.djsh.net

Make sure you have rpm-fusion repo installed

rpm -Uvh http://download1.rpmfusion.org/nonfree/fedora/rpmfusion-nonfree-release-stable.noarch.rpm http://download1.rpmfusion.org/free/fedora/rpmfusion-free-release-stable.noarch.rpm

Install Driver using yum

yum --enablerepo=rpmfusion-nonfree-updates-testing install akmod-fglrx xorg-x11-drv-fglrx xorg-x11-drv-fglrx-libs.
Categories: Uncategorized

fglrx Install script fedora 10

December 27, 2008 8 comments

THIS SCRIPT IS NO LONGER REQUIRED SINCE PACKAGES IN RPMFUSION REPO WORK .

http://djsh.net/2009/01/26/fedora-10-fglrx/

Note:

– Remove all packages related to previous attempts to install fglrx

– It now supports x86_64 but requires more testing on the platform

– Since its new it will have many unobserved bugs even though it has been tested

-This uses the ati driver at http://ati.amd.com/support/driver.html

-For x86_64 bit OS you can either select  64 bit driver (while installing) or install 32 bit driver and remove # sign in front of a section called NOTE.

-If any bugs are encountered please comment about them (with details) at this blog.

To install put driver and script in same folder and run sh installfglrx (root mode)

DOWNLOAD LINK

AFTER INSTALL(if everything is working_:

edit /boot/grub/menu.conf

instead  of nomodset put vga=0xA

A is the VESA mode http://en.wikipedia.org/wiki/VESA_BIOS_Extensions


Categories: Uncategorized

Plymouth themes For Fedora 10

December 9, 2008 Leave a comment

Open Terminal in root/super-user mode
yum install plymouth-plugin-{fade-in,pulser,spinfinity}

plymouth-set-default-plugin name
name is the plugin you wnat to use
/usr/libexec/plymouth/plymouth-update-initrd

Categories: Uncategorized Tags: ,