Tagged: howto Toggle Comment Threads | Keyboard Shortcuts

  • diegor 10:48 pm on October 5, 2014 Permalink | Reply
    Tags: howto, , , vmware   

    HOWTO: Ctrl/Alt/Shift keys not working in VMWare 

    Sometime when using VMWare under linux, it makes impossible the usage of Ctrl/Alt/Shift keys on the virtualised OS. The solution is quite easy though. Open a terminal and type the following command:

    #> setxkbmap

    That’s it.

  • diegor 10:23 am on August 28, 2014 Permalink | Reply
    Tags: howto,   

    HOWTO: check if I am in a screen session 

    #> echo $STY

    If you are in a screen session, you’ll see something similar to

    #> echo $STY

    If you aren’t, you’ll see nothing.

    #> echo $STY

  • diegor 5:03 pm on August 14, 2014 Permalink | Reply
    Tags: , howto   

    HOWTO: restore a deleted file in git 

    #> git rev-list -n 1 HEAD -- path_to_file  #this gives you the commit's hash
    #> git checkout commit_hash^ -- path_to_file # it restores the file

  • diegor 10:26 am on July 18, 2014 Permalink | Reply
    Tags: howto,   

    HOWTO: rename screen session 

    Within screen:

    C-a :sessionname newSessionName

    where C-a is Ctrl-a

    Without attaching a screen session:

    #> screen -X sessionname newSessionName

    If you have multiple screen running you have to specify which one to rename:

    #> screen -S sessionToRename -X sessionname newSessionName

  • diegor 6:44 pm on June 19, 2014 Permalink | Reply
    Tags: howto,   

    HOWTO: schedule repeating events with Python 

    import sched
    import datetime, time
    class PeriodicScheduler(object):                                                
        def __init__(self):                                                         
            self.scheduler = sched.scheduler(time.time, time.sleep)                 
        def setup(self, interval, action, actionargs=()):                           
            self.scheduler.enter(interval, 1, self.setup,                           
                            (interval, action, actionargs))                         
        def run(self):                                                              
    #This is the event to execute every time
    def periodic_event():
        print datetime.datetime.now()
    INTERVAL = 1 # every second
    periodic_scheduler = PeriodicScheduler() 
    periodic_scheduler.setup(INTERVAL, periodic_event) # it executes the event just once
    periodic_scheduler.run() # it starts the scheduler

  • diegor 6:40 pm on April 2, 2014 Permalink | Reply
    Tags: , howto   

    HOWTO: move a commit to another branch using GIT 

    #> git log #Get the commit_ID that you want to move
    #> git checkout [right_branch]
    #> git cherry-pick [commit_ID]

  • diegor 6:10 pm on March 13, 2014 Permalink | Reply
    Tags: awk, howto,   

    HOWTO: print the nth line of a file 

    #> awk 'NR==1524' file.txt # print the 1524th line of the file using awk
    #> sed -n '1244p' file.txt # print the 1244th line of the file using sed

Compose new post
Next post/Next comment
Previous post/Previous comment
Show/Hide comments
Go to top
Go to login
Show/Hide help
shift + esc