- git add -u to add all modified files in the index.
- git checkout -f to trash all uncommitted changes. Useful before pulling.
- git stash as an alternative to above.
- git diff --cached to see the added changes.
- git rebase to squash multiple commits into a commit before pushing. Rebasing is useful for other stuff, but that needs more exploration. git rebase -i origin/master to merge all unpushed commits.
- git commit --amend might be an alternative for that as well.
- See here for some other tips.
Sunday, November 01, 2009
Some Git Tips
Friday, October 30, 2009
How to make forward-word, backward-word, treat underscore as part of a word?
This tip is via here.
For MATLAB, the corresponding command is:
(modify-syntax-entry ?_ "w" matlab-mode-syntax-table)
Batch Conversion of Image Files
To convert eps files to png, one can use imagemagick's convert and the good old find along with the -exec option:
find -name '*.eps' -exec convert {} {}.png \;
However, there is an easier command:
mogrify -format png *.eps
will do the job more elegantly. Using the -path png will output the images in a folder named png instead of the current folder.
Imagemagick has some other useful commands:
- display : Displays the image
- montage : Concatenates several images
- animate : Animates several images
man imagemagick for more.
Tuesday, October 27, 2009
Saturday, October 24, 2009
Flex ve Türkçe Karakterler
Flex uygulamanızı derlerken şuna benzer bir hata alıyorsanız bu sorun sisteminizdeki Türkçe ayarlarından kaynaklanmakta:
Error: Could not resolve to a component implementation.
Bunu düzeltmek için birkaç yol var:
Windows'ta iseniz Flex SDK'nın bin klasöründeki jvm.config dosyasındaki
java.args=-Xmx384m -Dsun.io.useCanonCaches=false
satırını
java.args=-Xmx384m -Duser.language=en -Duser.region=US -Dsun.io.useCanonCaches=false
olarak değiştirin.
Mac ya da Linux'ta ise mxmlc dosyasını bir metin düzenleyici ile açıp
VMARGS="-Xmx384m -Dsun.io.useCanonCaches=false"
satırını
VMARGS="-Xmx384m -Dsun.io.useCanonCaches=false -Duser.language=en -Duser.country=US"
olarak değiştirin.
Ayrıntılı bilgi: http://livedocs.adobe.com/flex/3/html/help.html?content=configuring_environment_3.html
Flex Builder kullanıyorsanız, alternatif olarak FlexBuilder.ini dosyasına -Duser.language=en
-Duser.location=us
satırlarını ekleyebilirsiniz. Mac'te bu dosyayı bulmak için Flex Builder.app'e sağ tıklayın, Show Package Contents'i tıklayın, Contents>MacOS klasörüne gidin.
Monday, October 12, 2009
Wednesday, September 02, 2009
KDE Submenu Action For Getting the Public URL of a File in the Dropbox Public Folder
There is yet no equivalent for the nautilus extension for GNOME for KDE, so one can't right click on files in Dropbox's Public folder to get the Public URL.
To overcome this limitation, one can use a KDE submenu action.
First, create a .desktop file, named dropboxpublic.desktop with the following contents and save it under /usr/share/kde4/services/ServiceMenus or ~/.kde/share/kde4/services/ServiceMenus .
The exact location for the parent directory of ServiceMenus is obtained by "kde4-config --path services" output.
[Desktop Action Dropbox Public URL]
Exec=dropbox puburl %u | xclip -selection clipboard
Name=Get Public URL
[Desktop Entry]
Actions=Dropbox Public URL;
MimeType=application/octet-stream;
ServiceTypes=KonqPopupMenu/Plugin;
Type=Service
X-KDE-ServiceTypes=KonqPopupMenu/Plugin,
This action requires the xclip program to copy the output of the action to clipboard, so install that using your package manager.
Next, when you right click a file in Dropbox/Public folder, and go to Actions-Get Public URL, the URL should be copied to the clipboard.
Tip: If you add
X-KDE-Priority=TopLevel
it will appear in the top level, not under Actions menu.
Saturday, August 22, 2009
Weather Information on Command Line
Weather information can be obtained at command line using a Python script that retrieves the weather information from Yahoo API found here at GitHub.
For Ankara, the location code is TUXX0003 and I aliased it in ~/.bash_profile as:
alias hava='weather.py TUXX0003 -m c -f 2'
Tuesday, August 18, 2009
Compiling Documents via Both LaTeX and XeLaTeX
To compile files that require XeLaTeX-specific options using LaTeX, use the \ifx\XeTeXversion\undefinedcheck.
\documentclass[a4paper,12pt]{report}
\ifx\XeTeXversion\undefined
\usepackage[utf8]{inputenc}
\else
\usepackage{fontspec}
\usepackage{xunicode}
\usepackage{xltxtra}
\setmainfont[Mapping=tex-text]{Gentium}
\fi
\begin{document}
\ifx\XeTeXversion\undefined
Hello World from LaTeX!
\else
Hello World from XeLaTeX!
\fi
\end{document}
Sunday, August 16, 2009
Subscribe to:
Posts (Atom)