Monday, March 25, 2013

HowTo Get a New Gmail Google account without a Phone Number - Tutorial Guide

To get a Gmail account with no phone or cell phone number, all you need is an email invite from someone who already has a Gmail account.

Here are the steps:
  1. Go into the gmail account and open up messaging on the left side.


  1. Type in the email address to send the invitation to, then click "Invite to chat".




An invitation will be sent to the email address.

When the invitation is received, click on the link in the email. Fill out the information form (name, username, password, etc). On the next page it will ask to "Accept" the invitation from the original Gmail account. Click Yes Accept the Invitation.


Comment or write me at sepero 111 @ gmail . com

Wednesday, January 30, 2013

Django Settings.py: Safer Variable Imports

In Django, global module variables are saved in the settings.py file. These variables are commonly brought into local modules like the code below. Have a brief look-
from django.conf import settings

SECRET_KEY = getattr(settings, 'SECRET_KEY', '')
TEMPLATE_DEBUG = getattr(settings, 'TEMPLATE_DEBUG', False)
MAX_CONTENT_LENGTH = getattr(settings, 'MAX_CONTENT_LEN', 5000)
DATETIME_FORMAT = getattr(settings, 'DATETIME_FORMAT', 'Y-m-d H:i T')
FORM_MIN_SUBMIT_TIME = getattr(settings, 'FORM_MIN_SUBMIT_TIME', 6)
FORM_MAX_SUBMIT_TIME = getattr(settings, 'FORM_MIN_SUBMIT_TIME', 60 * 60 * 24 * 7)

Now let me ask, did you notice the typo? Most people won't, so congratulations on you if you did. There are actually 2 typos. The typos are on the variables-
MAX_CONTENT_LENGTH and FORM_MAX_SUBMIT_TIME






Why did this happen? Why is it difficult to detect?

Firstly why this happens is because we have an excessive amount of repetitive code typing. This is just a fact of number probabilities- The less a person has to type, the less likely they are to make a typo. As a person is required to type more, the odds of a typo goes up.

Secondly why this happens is because it happens silently without ever producing any warning or alert. It would be prudent to have at least a log of when a variable is not supplied from django settings.

To solve this, I use the following simple function to care of both of these problems for me.
def load_attrs(attr_dict):
    """Adds attributes to the previous namespace from settings."""
    previous_namespace = sys._current_frames().values()[-1].f_back.f_globals
    for attr, default in attr_dict.iteritems():
        try:
            previous_namespace[attr] = getattr(settings, attr)
        except AttributError:
            previous_namespace[attr] = default
            if DEBUG:
                logging.debug("Failed to load settings."+ attr)


I expect you should generally be able to read this code, except perhaps line 3. Line 3 gets the global namespace of where ever this function was called from. It adds the attributes to that namespace.

Here is an example of importing the function and using it in a module. Compare this to the code at the top of the page-
from django.conf import settings
from apps.lib.lib import load_attrs

load_attrs({
        'SECRET_KEY': '',
        'TEMPLATE_DEBUG': False,
        'MAX_CONTENT_LENGTH': 5000,
        'DATETIME_FORMAT': 'Y-m-d H:i T',
        'FORM_MIN_SUBMIT_TIME': 6,
        'FORM_MAX_SUBMIT_TIME': 60 * 60 * 24 * 7,
})






Much less typing, much less room for error, and IMHO much cleaner looking code. Hopefully somebody will suggest a function like this to be included in a future version of Django.


Remove spaces to email me: sepero 111 @ gmail . com

django settings module variables


Monday, October 29, 2012

Linux: Cool your CPU temperature with frequency throttling

Last night I went to sleep while running a heavy program that used 100% of my Intel i7 multicore processor. When I woke up in the morning, I found my laptop powered off. A look through the /var/log/syslog confirmed that it had shut off due to over heating.

So to control temperature, I wrote a script to throttle cpu frequency. This script must be run with root privileges (sudo) to work. For a desired max temperature of 80 degrees Celsius, use a command like this:
sudo ./temp_throttle.sh 80

This can also result in longer battery life on laptops and portable devices.

Note: This script may not be effective if your system over heating is primarily due to factors other than your CPU. This script simply throttles your CPU frequency based on your systems reported temperature.

Click here to download this temperature throttling script for Linux. Please direct links to this page and the download location will remain up to date.

New User Resources:


Download: temperature throttling script - temp_throttle.sh
https://github.com/Sepero/temp-throttle
If this script helps you in any way, please pay me with a message of thanks, and share this page with others. If you have better ideas or suggestions, then contact me in the comments or email sepero 111 @ gmail.com



Keywords:
cpu scaling temperature control Linux

Wednesday, October 17, 2012

Solved - 4shared desktop crashes on Linux (desktop4shared)

4shared currently offers a massive 15GB of storage for free on their servers, and they offer a Java client program for Ubuntu/Debian Linux named 'desktop4shared'.

When trying to run this program with Ubuntu 12.04 (or perhaps Ubuntu 12.10), the following error can occur:
$ desktop4shared 
Guessing JAVA_HOME...
Assuming JAVA_HOME=/usr/lib/jvm/java-6-openjdk-amd64
Starting desktop4shared...
19:59:43 [AWT-EventQueue-0] INFO  Initialize - UI Initialized in 215
19:59:49 [main] ERROR common.GlobalExceptionHandler - Uncaught exception in thread [main] : the number of constructors during runtime and compile time for groovy.util.FactoryBuilderSupport do not match. Expected 3 but got 2
java.lang.IncompatibleClassChangeError: the number of constructors during runtime and compile time for groovy.util.FactoryBuilderSupport do not match. Expected 3 but got 2
        at griffon.app.ApplicationBuilder.<init>(ApplicationBuilder.groovy:26) ~[griffon-rt-0.9.jar:0.9]
        at griffon.app.ApplicationBuilder.<init>(ApplicationBuilder.groovy) ~[griffon-rt-0.9.jar:0.9]
        at griffon.builder.UberBuilder.uberInit(UberBuilder.groovy:73) ~[griffon-rt-0.9.jar:0.9]
        at org.codehaus.griffon.runtime.util.CompositeBuilderHelper.handleLocalBuilder(CompositeBuilderHelper.groovy:86) ~[griffon-rt-0.9.jar:0.9]
        at org.codehaus.griffon.runtime.util.CompositeBuilderHelper$handleLocalBuilder.callStatic(Unknown Source) ~[na:na]
        at org.codehaus.griffon.runtime.util.CompositeBuilderHelper$_createBuilder_closure1.doCall(CompositeBuilderHelper.groovy:51) ~[griffon-rt-0.9.jar:0.9]
        at org.codehaus.griffon.runtime.util.CompositeBuilderHelper.createBuilder(CompositeBuilderHelper.groovy:50) ~[griffon-rt-0.9.jar:0.9]
        at org.codehaus.griffon.runtime.util.CompositeBuilderHelper$createBuilder.call(Unknown Source) ~[na:na]
        at org.codehaus.griffon.runtime.util.GriffonApplicationHelper.buildMVCGroup(GriffonApplicationHelper.groovy:233) ~[griffon-rt-0.9.jar:0.9]
        at org.codehaus.griffon.runtime.util.GriffonApplicationHelper$buildMVCGroup.callStatic(Unknown Source) ~[na:na]
        at org.codehaus.griffon.runtime.util.GriffonApplicationHelper.createMVCGroup(GriffonApplicationHelper.groovy:191) ~[griffon-rt-0.9.jar:0.9]
        at org.codehaus.griffon.runtime.util.GriffonApplicationHelper$createMVCGroup$0.callStatic(Unknown Source) ~[na:na]
        at org.codehaus.griffon.runtime.util.GriffonApplicationHelper.createMVCGroup(GriffonApplicationHelper.groovy:171) ~[griffon-rt-0.9.jar:0.9]
        at org.codehaus.griffon.runtime.util.GriffonApplicationHelper$createMVCGroup.call(Unknown Source) ~[na:na]
        at griffon.core.BaseGriffonApplication$_startup_closure2.doCall(BaseGriffonApplication.groovy:178) ~[griffon-rt-0.9.jar:0.9]
        at griffon.core.BaseGriffonApplication.startup(BaseGriffonApplication.groovy:177) ~[griffon-rt-0.9.jar:0.9]
        at griffon.core.GriffonApplication$startup.call(Unknown Source) ~[na:na]
        at griffon.swing.SwingApplication.startup(SwingApplication.groovy) ~[griffon-rt-0.9.jar:0.9]
        at griffon.core.GriffonApplication$startup.callCurrent(Unknown Source) ~[na:na]
        at griffon.swing.SwingApplication.realize(SwingApplication.groovy:61) ~[griffon-rt-0.9.jar:0.9]
        at griffon.application.StandaloneGriffonApplication$realize.call(Unknown Source) ~[na:na]
        at griffon.swing.SwingApplication.main(SwingApplication.groovy:107) ~[griffon-rt-0.9.jar:0.9]

Credit for figuring this problem out goes to a user by the handle Zorael over at UbuntuForums.org  http://ubuntuforums.org/showpost.php?p=12104449&postcount=4

The problem is that desktop4shared is using an outdated library reference in the library named "groovy". To fix this, an older version of groovy needs to be installed on the system.

Download the older library version here:
http://mirror.pnl.gov/ubuntu//pool/universe/g/groovy/groovy_1.7.10-2_all.deb

You should be able to click to install the library, but if that doesn't work, you may use this command in a terminal (correct the path location for your system):
sudo dpkg -i /path/to/groovy_1.7.10-2_all.deb

To prevent the library from accidentally upgrading, run these two commands in the terminal:
printf 'Package: groovy\nPin: version 1.7*\nPin-Priority: 1001\n' | sudo tee /etc/apt/preferences.d/groovy
echo groovy hold | sudo dpkg --set-selections


Comment or write me at sepero 111 @ gmail . com

Wednesday, September 26, 2012

How to download Hulu videos on Linux

Intro

Downloading Hulu, bbs, pbs, and other videos on Linux is remarkably simple- once you know how. It took me quite a bit of digging to figure it out though.

These websites use a type of video transmission called rtmp, and this prevents them from being downloaded more easily, like good and trust worthy youtube videos.

Install

To download rtmp videos, you will first need to have installed the latest version of rtmpdump. (As of the time of this writing the latest version is rtmpdump 2.4) You may be able to easily install this package using your distributions software center.

After installing rtmpdump you should have access to 3 commandline programs: rtmpdump, rtmpsrv, and rtmpsuck.

Local Script

Create a folder named "rtmp" (or whatever you like) to download your videos to.

In that folder, save this as a file named "riprtmp.sh"
#!/bin/bash
# riprtmp.sh

# Redirect rtmp internet signals locally.
sudo iptables -t nat -A OUTPUT -p tcp --dport 1935 -j REDIRECT

# load video into browser and run rtmpsrv
exec 2> /dev/null # Comment out this line if having problems.
rtmpsrv | grep "rtmpdump" | tee ripinfo.txt &
echo "Press enter after trying to load video"
read i
killall rtmpsrv
echo "Output sent to ripinfo.txt"

# Undo previous redirect for rtmp signals.
sudo iptables -t nat -D OUTPUT -p tcp --dport 1935 -j REDIRECT


After saving the file, be sure to set executable permissions so that you can run it as a script: chmod +x riprtmp.sh. This script will be used to collect the info we need for rtmpdump to download the video locally.

How To Run It

At this point everything should be ready! Here are the steps to get the video you want to download.
  • Open a commandline and navigate to your "rtmp" directory.
  • Begin running the script ./riprtmp.sh. It will prompt for administrator access, and you need to enter your password.
  • Try to load the video in Firefox (the video should fail to load because it is being redirected to rtmpsrv in the script).
  • After the video fails to load, go back to the script and press Enter.
  • A new file now exists called "ripinfo.txt". Open this file.
  • Inside the "ripinfo.txt" there should be a long line that starts with "rtmpdump".
  • Copy and paste that long "rtmpdump" line into the commandline and press Enter.
  • Your video should now be downloading.


Happy offline video watching. Comment or write me at sepero 111 @ gmail . com

Friday, June 8, 2012

How To fsck a Truecrypt Volume (solution)

In Linux, unencrypting a truecrypt volume as "unmounted" will create a temporary file like this
/tmp/.truecrypt_aux_mnt1/volume



Recently when trying to run fsck or e2fsck on a corrupted truecrypt volume, I was presented with this
# fsck.ext4 -p /tmp/.truecrypt_aux_mnt1/volume
/tmp/.truecrypt_aux_mnt1/volume: recovering journal
fsck.ext4: unable to set superblock flags on /tmp/.truecrypt_aux_mnt1/volume


/tmp/.truecrypt_aux_mnt1/volume: ********** WARNING: Filesystem still has errors **********




Most websites will tell you to recover using a separate super block, but that is likely not the problem here. The problem is that fsck.ext4 can't properly fix an ext4 image file directly. The file must be mounted with losetup, and then it can be checked properly.
# losetup -f /tmp/.truecrypt_aux_mnt1/volume
# fsck.ext4 /dev/loop0e2fsck 1.42 (29-Nov-2011)
/dev/loop0: recovering journal
Setting free inodes count to 15549549 (was 15549553)
Setting free blocks count to 19290620 (was 19290665)



After mounting the image to a loopback device you can see that fsck was successful. To unmount the image from the loopback device, run
# losetup -d /dev/loop0



encrypted mounting ubuntu

Comment or write me at sepero 111 @ gmail . com

Monday, May 28, 2012

Install Puppy Linux to USB without a CD

[This is a rough guide, open for improvement. Leave any tips in a comment, or email me.]

A couple days ago I installed Puppy Linux (Precise 5.4.3) to a USB Flashdrive without a CD. I couldn't find a decent guide for this anywhere, so I figured it out primarily with help from a DSL tutorial. I did the install using Ubuntu Linux (which has built in support for reading iso files). If you are on another operating system, you will need some software like WinCDEmu to read the files from the iso file. You will also need to have Syslinux software to install a bootloader on the device.
apt-get install syslinux

Puppy Linux is great because it will fit on those old 256MB, 512MB, and 1GB USB disks, giving them new life.

Here I will roughly list the steps required to install Puppy Linux to USB.

  1. Format the usb to fat32 file system.
  2. I don't think this is completely necessary, but if possible, mark the usb partition as bootable. (using a program like fdisk)
  3. Prepare (mount) the Puppy Linux iso file so that you can for read/extract the files from it.
  4. Copy all the files from the iso to the usb stick.
  5. Create an empty file on the USB drive named: USBFLASH
  6. On the USB, rename the file isolinux.cfg to syslinux.cfg.
  7. Edit syslinux.cfg and change "pmedia=cd" to "pmedia=usbflash". (Be aware, editing this file may prevent USB booting if your editor modifies carriage return on the line ends.)
  8. Install syslinux loader to the USB drive in Linux
    syslinux -s /dev/sdb1

    Install syslinux loader to the USB drive in Windows (assuming F: is your usb)
    syslinux.exe -mas F:


Congratulations if you made it this far. You should now be able to reboot into your new Puppy Linux USB installation. Here is another great resource for installing syslinux, which may help on using with Windows-  http://www.syslinux.org/wiki/index.php/HowTos

Resources:
Puppy Linux pmedia options, and other flags.
quicklist: usbflash usbhd usbcd ideflash idehd idecd idezip satahd satacd scsihd

Please leave comments and feedback below, or write to sepero 111 @ gmail . com

keywords
usb stick pendrive flashdrive pen flash drive puppylinux