Donate to support Ukraine's independence.

04 Mar'12

Sublime Text 2

sudo add-apt-repository ppa:webupd8team/sublime-text-2
sudo apt-get update
sudo apt-get install sublime-text-2

Continue reading

Category: 

22 Feb'12

django default manager

You can add a manager to all models of some type if you subclass an abstract model which declares a manager.

For example, you can declare ugcModel with publication status and published_items manager.

Link: https://docs.djangoproject.com/en/dev/topics/db/managers/#custom-managers-and-model-inheritance

Continue reading

15 Feb'12

MSP430 Launchpad

This is a link to a web page: https://cacheattack.blogspot.com/2011/06/quick-overview-on-interfacing-msp430.html

Copy: PDF

Continue reading

Category: 

15 Feb'12

Git through http proxy

Use this command to globally configure git:

git config --global http.proxy http://10.108.4.62:8080

Continue reading

10 Feb'12

Git default remote

git branch --set-upstream master <strong>origin</strong>/master

origin - name of the default remote

Continue reading

10 Feb'12

Sync folders between computers within your home network via SyncToy 2.1!

Before I knew this great software for file sync in Windows 7 exists I used to run PowerShell scripts.

Here is the interface of this program by Microsoft developers:

SNAG-0030
SNAG-0031

It has few operational modes:

  1. Sync folders
  2. Echo folders
  3. Contribute to folders

Continue reading

08 Feb'12

Generating keyboard events

import pyatspi
reg = pyatspi.Registry.generateKeyboardEvent
reg(36, None, pyatspi.KEY_preSSRELEASE) #Enter

Continue reading

Category: 

08 Feb'12

Python chroot

What is important to remember is that chroot will allow you cd into /, and that will correspond to the dir you chrooted in:

os.chroot(os.path.abspath(os.path.dirname(__file__)))
for opt in glob.glob("/*"):
    print "\t-> %s" % opt

try:
    os.chdir("/root/")
    print "Chroot FAIL"
    print os.getcwd()
except Exception as e:
    print "Chroot OK"

Continue reading

Category: 

08 Feb'12

Nonblocking console input in Python

By Nemesis Fixx:

import sys
import select
import tty
import termios
from threading import Thread

program_run = True
input_thread_timeout = 0.005 #seconds
quit_key = '\x1b' # x1b is ESC

#check stdin for input...
def isData():
        return select.select([sys.stdin], [], [], 0) == ([sys.stdin], [], [])

#check n terminate program on terminal condition,
#from a separate thread
class waitOnInput(Thread):
    def run(self):
        old_settings = termios.tcgetattr(sys.stdin)
        try:
            tty.setcbreak(sys.stdin.fileno())
            global program_run
            thread_run = True
            while thread_run:
                if isData():
                    c = sys.stdin.read(1)
                    if c == quit_key:
                        break
                        thread_run = False
                        program_run = False
        finally:
            termios.tcsetattr(sys.stdin, termios.TCSADRAIN, old_settings)
            thread_run = False


t …

Continue reading

07 Feb'12

DAA

DAA is a PowerISO type of image. To mount it with Daemon Tools, use DAA 2 ISO tool first

Continue reading

← Previous Next → Page 6 of 10