mvn dependency:copy -Dartifact="org.codehaus.groovy:groovy-all:2.3.6" -DoutputDirectory=. && \
_PWD=$PWD && \
groovy() { java -jar ${_PWD}/groovy-all-2.3.6.jar "$@"; }
piątek, 29 sierpnia 2014
Quick way of installing groovy without root priviliges
piątek, 15 sierpnia 2014
How to put OSX symbols like command (⌘), shift (⇧) and others in html document
- ⇧ (⇧) shift
- ⌃ (⌃) ctrl
- ⌘ (⌘) command
- ⌥ (⌥) option
- ⇥ (⇥) tab
- ⎋ (⎋) escape
-  () apple - only on Macs
OSX 10.9.x Mavericks - how to make eclipse shortcut command + comma works properly (or more precisely - how to change shortcut for "Preferences..." menu option)
Actually there is nothing wrong with the default one ⌘, - unless you are Eclipse user extensivly using "Next/Previous Annotation" and comes from Windows/Linux world :>. In such a case you encounter weird shortcuts ⌘. for "next" and ⇧⌘. for "previous". This is at least unnatural (esspecially for my fingers :)).
Ok, usually when you'd like to change any keyboard shortcut you press ⌃F2, open System Preferences..., type "Keyboard shortcuts" - but looking back and forward through all the categories you are not able to found "Preferences..." one. The solution is to go to the last one category - "App Shortcuts". Once done under box on the right two little buttons should appear [+][-] - click on the [+]. In "Menu Title" text box type "Preferences...", and put new shortcut (eg. ⇧⌘,). Now old shortcut is freed.
Now as we have ⌘, freed, we can assign it to "Previous" command in Eclipse. To do this go the the Eclipse -> Preferences (you can use newly set shortcut ;)) -> General -> Keys -> type "Previous" and replace the shortcut.
poniedziałek, 28 lipca 2014
How to implement onSelectionChange listener on CTabItem tabs of the CTabFolder widget
addListener(int eventType, Listener listener) delivered with Widget class.
CTabItem item = new CTabItem(tabFolder, SWT.NULL);
item.setText(tabTitle);
Composite container = createContent(item.getParent());
item.setControl(container);
item.addListener(SWT.SELECTED, new Listener() {
@Override
public void handleEvent(Event event) {
masterDetailsBlock.setDefaultSelection();
}
});
But by default there is no such an event notified by CTabFolder. That is why we need take care of it.
tabFolder.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
tabFolder.getSelection().notifyListeners(SWT.SELECTED, new Event());
}
});
Thats all. Works like a charm ;)
czwartek, 3 lipca 2014
Docker howto - most useful commands with examples
Docker commands
Most basic commands:
docker pull ubuntu | - downloads image from Docker repository |
docker ps -a | - shows all available containers |
docker ps -as | - shows all containers with the actual size of the rw-layer |
docker ps -lq | - finds out container id of the last started container |
|
How to remove all containers which name or image matches specified regular expression
for i in $(docker ps -a | grep "REGEXP_PATTERN" | cut -f1 -d" "); do echo $i; done
Note that this command does not filter containers on any particular field - there is no difference if pattern is found on container name, image name, or any other field.
How to run bash on running container
docker exec -ti ceb1be03097d /bin/bash
How to create image based on container
docker commit ceb1be03097d/ :
Dockerfile
How to change password to the root user?
RUN echo 'root:my_password' |chpasswd
Troubleshooting
$ docker ps
FATA[0000] Get http:///var/run/docker.sock/v1.16/containers/json: dial unix /var/run/docker.sock: permission denied. Are you trying to connect to a TLS-enabled daemon without TLS?
Try the following: $ sudo docker ps
środa, 4 czerwca 2014
Binding key strokes to eclipse commands
The following special literals are available :
-
SPACE,TAB,CR,DEL,ESC,BREAK,BS,CAPS_LOCK,END,HOME,INSERT,PAGE_UP,PAGE_DOWN ARROW_DOWN,ARROW_LEFT,ARROW_RIGHT,ARROW_UP-
F1,F2,F3,F4,F5,F6,F7,F8,F9,F10,F11,F12,F13,F14,F15,FF -
NUM_LOCK,NUMPAD_0,NUMPAD_1,NUMPAD_2,NUMPAD_3,NUMPAD_4,NUMPAD_5,NUMPAD_6,NUMPAD_7,NUMPAD_8,NUMPAD_9,NUMPAD_ADD,NUMPAD_DECIMAL,NUMPAD_DIVIDE,NUMPAD_ENTER,NUMPAD_EQUAL,NUMPAD_MULTIPLY,NUMPAD_SUBTRACT -
LF,NUL, ,PAUSE,PRINT_SCREEN,SCROLL_LOCK, andVT
poniedziałek, 12 maja 2014
How to lock IntelliJ IDEA on Unity launcher
Now you can go to terminal (Ctrl+Atl+T) and edit newly created desktop file ~/.local/share/applications/jetbrains-idea-ce.desktop
The key point is to fix Exec entry - should be path to the ./idea.sh start script. Note that if you have not JAVA_HOME set in your environment, you need set one as shown below.
[Desktop Entry] Encoding=UTF-8 Version=1.0 Type=Application Name=IntelliJ IDEA Icon=jetbrains-idea-ce.png Path=/home/krma/Downloads/idea-IC-135.690/bin Exec=env JAVA_HOME=/usr/lib/jvm/java-8-oracle /home/krma/Downloads/idea-IC-135.690/bin/idea.sh StartupNotify=false StartupWMClass=jetbrains-idea-ce OnlyShowIn=Unity; X-UnityGenerated=trueThat is basically all.