Shortcuts:
M-: - block comment
M-/ - auto complete from context
C-M-% - regex-replace
C-q <specialChar> - C-q <TAB>, <SPACE> inserts those special chars
Commands:
M-x whitespace-mode - see all the cursing characters... :-P
M-x man RET cmd - view a man page properly in emacs
Startup file location ~/.emacs
Tip: Avoid too many non-standard configurations. Keep your configuration file small and lean. If you evolve and/or heavily modify your environment, it will be increasingly harder to stay productive when you move over machines and won't have access to your superCustomized.el
or
Hypothesis 1: make your file available through some http service. curl it down. run with emacs and watch for errors?
i.e. `emacs some option <yourConfig>.el` if $? == 1 { #don't move HEAD, latest emacs does not work }. You should let me know once you figure this out. :D
Reference links:
http://sachachua.com
Sunday, February 24, 2013
Rename bunch of files with Python
#!/usr/bin/env python
import os, re, commands
fileNameRegEx = '^([0-9])+'
pattern = re.compile( fileNameRegEx )
filesRenamed = 0
for f in os.listdir( '.' ):
match = pattern.search( f )
if match:
newFileName = "{0}.regex".format( match.group(0) )
print "Renaming {0} to {1}".format( f, newFileName )
statusTuple = commands.getstatusoutput( 'mv {0} {1}'.format( f, newFileName ) )
if (statusTuple[0] == 0): filesRenamed += 1
print "Total files renamed {0}".format ( filesRenamed )
import os, re, commands
fileNameRegEx = '^([0-9])+'
pattern = re.compile( fileNameRegEx )
filesRenamed = 0
for f in os.listdir( '.' ):
match = pattern.search( f )
if match:
newFileName = "{0}.regex".format( match.group(0) )
print "Renaming {0} to {1}".format( f, newFileName )
statusTuple = commands.getstatusoutput( 'mv {0} {1}'.format( f, newFileName ) )
if (statusTuple[0] == 0): filesRenamed += 1
print "Total files renamed {0}".format ( filesRenamed )
Thursday, February 7, 2013
Music - Above & Beyond
A post completely? (almost) unrelated to programming, software engineering. Big fan of above and beyond podcast. (http://www.mixcloud.com/aboveandbeyond). Check it out, if you like electronic, trance music and code away that python <insertYourLangHere> script, class away.
Wednesday, February 6, 2013
Managing multiple identities with git and ssh
If you have multiple git repositories, you should create an ~/.ssh/config file to reflect your "identities", here is mine:
# Default GitHub user
Host github.com
HostName github.com
PreferredAuthentications publickey
IdentityFile ~/.ssh/personalPrivateKey
# Work user account
Host supercode.com
HostName supercode.com
PreferredAuthentications publickey
IdentityFile ~/.ssh/my_workplace_companyPrivateKey
# Default GitHub user
Host github.com
HostName github.com
PreferredAuthentications publickey
IdentityFile ~/.ssh/personalPrivateKey
# Work user account
Host supercode.com
HostName supercode.com
PreferredAuthentications publickey
IdentityFile ~/.ssh/my_workplace_companyPrivateKey
Subscribe to:
Comments (Atom)