andreicek.eu

Andrei's personal site

What is ListMe

This is the perfect script for people who want to make their private collection of images, gifs, webms, or videos make public or make easier to search. All you have to do is put the index.php file in the folder of your choosing, make it available to your web server and done. When you navigate to it you will have a working BETA listing of files.

The look and feel is taken from 4Chan.

Take a look at the code here, or the project page. Example comming soon.

Have feedback on this post? Let @andreicek know on Twitter.

Want to talk about this over email? Contact me.

Install Gentoo general guide

I found this guide on 4Chan and am planning on making it so you can install it on a Mac.

boot a linux livecd

partition and format drive

go into drive

download and extract tar.gz file

sudo cp /etc/resolv.conf etc
sudo mount -t proc none proc
sudo mount --rbind /dev dev
sudo mount --rbind /sys sys

sudo chroot .

emerge --sync

echo -e "MAKEOPTS=\"-j4\"\nEMERGE_DEFAULT_OPTS=\"--keep-going=y --autounmask-write=y --jobs=4\"" >> /etc/portage/make.conf

emerge genkernel gentoo-sources grub dhcpcd

echo "MAKEOPTS=\"-j4\"" >> /etc/genkernel.conf

genkernel all

grub2-install /dev/sda
grub2-mkconfig > /boot/grub/grub.cfg

rc-update add dhcpcd default

passwd

exit

sudo reboot

Have feedback on this post? Let @andreicek know on Twitter.

Want to talk about this over email? Contact me.

Hello from Baska

Posting will resume after my holidays. See you soon!

Have feedback on this post? Let @andreicek know on Twitter.

Want to talk about this over email? Contact me.

This is August: The Project Month

Since the school year is done, I have some free time. To use it how it shuld be used I compiled this little "project book" on what I will try to do the following 31 days. Here is my complete list:

Programming

  1. Pictionary Word List Generator (GUI application in Java)
  2. The Eudyptula Challenge
  3. PasteBin like application (JavaScript, PHP)
  4. C Basics
  5. Advanced C++
  6. Tomato timer app (Java, JavaScript)

Electronics

  1. Real Time Clock (Logisim simulation, Schematics and PCB)
  2. 4-bit ALU (Logisim simulation, Schematics and PCB)

Other:

  1. Read and study Computer Architecture

Thats it for now. As I advance I will post links to my GitHub repos and updates to my blog.

Have feedback on this post? Let @andreicek know on Twitter.

Want to talk about this over email? Contact me.

Ubuntu on MacBook Air - The easy way

This process is if you want single boot only. There are a lot of tutorials on dualboot out there.

1. Remove FileVault

You will not be able to remove partitions on the disk if you skip this step. If you however don't have FileVault turned on move along :)

2. Download Ubuntu and prepare the USB disk

In OSX go ahead and download the ubuntu-13.10-desktop-amd64.iso. Next you will need to convert the ISO file to IMG (OSX will append .dmg to it, it won't matter).

cd ~/Downloads
hdiutil convert -format UDRW -o ubuntu-13.10-desktop-amd64.img ubuntu-13.10-desktop-amd64.iso
diskutil list

From the diskutil list command find your USB and remeber/write down the disk ID (e.g. disk2). Be sure that this is correct.

diskutil unmountDisk /dev/disk<REPLACE ME>
sudo dd if=ubuntu-13.10-desktop-amd64.img.dmg of=/dev/rdisk<REPLACE ME> bs=1m

Now you have the installation drive ready. Be sure that you have backed up all data that you want to save. Note: Ubuntu will read NFS+ partitions if you happen to have such disks.

3. Removing OSX

Boot into recovery. Restart the computer and hold down CMD + R. The recovery menu will show up, select the Disk Utillity. Unmount the system disk, go to Partition tab and select from the dropdown menu 1 partition. As type select Free. Hit apply and power off the computer.

4. Boot into the instalation USB

Be sure that the disk is in the computer (use the left USB port, I had no luck with the right one...). Start up the computer while holding Alt button. The computer will boot up, and select Install Ubuntu from the menu.

5. Install Ubuntu

Next, next, next... ;)

6. Fix the boot issue

Now if you try booting you will get the missing "folder" icon. This is fixable quite easly. Plug the USB installation disk back in and this time boot into live CD. Open up the terminal and do the following:

sudo apt-get install efibootmgr
sudo efibootmgr

Ubuntu shuld be listed as Boot0000*. Run this simple command to fix the boot sudo efibootmgr -o 0,80. Now reboot and enjoy Ubuntu.

7. After the installation

I reccomend following this guide to setup Airport and improve battery life.

Have feedback on this post? Let @andreicek know on Twitter.

Want to talk about this over email? Contact me.

The wrong kind of attitude

I'm my short time I call my self a student I came across different people that share almost the same trait when it comes to development or studying. They, including me!, will often say that we are "too dense", "not smart enough", or "just don't get it" to the tasks that we predefined as dull, not offering a personal gain, or just plain not being needed. It is common knowledge that this slows you down quite a bit, and I am not here to talk about why this happens - but how to combat this.

Can't do attitude

We all start from this point. It doesn't matter if you study software development, art, or history - there is that one class that you said, after the first lecture - I can't do this. Now, what people do to combat this is asking one simple question - Why?. If that works for you, done. But I find that in 9/10 times this won't do the trick. So what is to do then?

The solution is not simple, and is not universal - but not only from per person point of view - from per time of day point of view too. You CAN NOT expect from yourself to work the same at any given time. So with no further ado -

The "solution"

There are four simple steps for doing this, and I will go thru every single one of them.

1. Start

In order to find where the problem is exactly you need to start working on it. It doesn't matter if it's just writing a few sentences, or initializing variables. What is important is to get your hands dirty. That brings me to the second step.

2. Try

Now, you may not know the solution to the given problem just yet - but you may as well try to fake it. Don't be afraid to make it as bad as you can. This is to make your brain think - "Ok, we've got this."

3. Scrap everything, despair for a second

Wow, my work is bad. Ctrl-A, Del. Where am I going with this. I should look for another job, gardening sounds like fun.

After this important step your brain will start thinking. Ok - so we have this thing A, and we need to get to this thing B. Think of key words, then google. Look at manuals, books, older work and the solution will start appearing in front of you. This isn't as hard as you think it is.

4. You may be here, or you may not

And it's Ok. It is fine to not know the solution to everything, but what is important in life is to at least try to get to the solution. With your half baked result you can now ask for help in a more constructive way. Your friends, colleges, forums, chats, etc.

Finally you'll be done. And another tasks awaits you. Rinse and repeat.

Please get in touch - tell me if I'm doing it wrong. Say hello.

Have feedback on this post? Let @andreicek know on Twitter.

Want to talk about this over email? Contact me.

What is VMMNG

I am happy to announce my new "tool" - vmmng. If you are like me you do not work on a Windows machine and you are "forced" to use ESXi. Turning VM's on and off at will can, and will, get a bit tedious. Using that pesky Windows VM to administrate the ESXi server by just turning off and on machines is a little bit stupid. View the project on GitHub.

There are commands for ESXi if you enabled SSH shell and they do work great but, again, I needed something that won't take forever to do. Log in into SSH, list the VM, power it on, log out. And in between - google the command for turning it off and on.

Here comes vmmng. A nifty tool written in ruby that I plan on building up to do even more stuff.

Be sure to enable SSH on the ESXi box and also to create a key pair for login so you don't have to provide the password.

Here is how to enable shell access on ESXi, and here is how to use key auth with ESXi.

How to install vmmng

  1. Clone the repo

    git clone https://github.com/andreicek/vmmng.git

  2. Edit the script and replace USERNAME and HOSTNAME

    USERNAME = root
    HOSTNAME = the.server.com
    
  3. Move the vmmng script to your bin folder

    mv vmmng ~/.dotfiles/bin

  4. Allow it to run

    chmod +x ~/.dotfiles/bin/vmmng

Have feedback on this post? Let @andreicek know on Twitter.

Want to talk about this over email? Contact me.

Latex in 10 minutes

I was frustrated with complicated tutorials and bunch of text needed to learn LaTeX. Once I figured out everything I need for the beginning I wanted to make this short tutorial. I won't go into installing LaTeX, but all you are ever going to use is pdflatex. To build a document you do pdflatex file.tex and you have a PDF ready. You can take a look at my repo here to see this in use.

Start the document with the documentclass command \documentclass{article}, and then list all the userpackages you are going to use. I use amsmath to have a align environment for my equations, and inputenc UTF-8 because I need čćžšđ for my homework.

Next on \begin{document} will start the document and \end{document} will end the document. That is the bare bones for our LaTeX document. This will compile just fine but will return a blank PDF. Next on are "meta data" of our document, such as date, title, author, etc. Not surprisingly the commands correspond.

\title{Točno riješenje zadatka}
\author{Andrei Zvonimir Crnković, \\
        Programsko inženjerstvo, \\
        Visoka škola za primjenjeno računarstvo, \\
        Zagreb \\
        \texttt{acrnko2@racunarstvo.hr}}
\date{\today}
\maketitle

Note \texttt{acrnko2@racunarstvo.hr}, this makes your email clikable in the PDF - handy! Next are titles and text. For titles you have abundance of choices but in reality you will only use two: \section{Our Title} and \subsection{Our sub title}. The first option will create a bigger title, and the other a smaller title. The title will be numbered! To make it unnumbered just add * to the end of command, eg. \subsection*{No numbers - yaay}. To add a text just write!

\subsection*{Lorem ipsum}
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Donec justo leo, iaculis vitae nibh a, rhoncus porttitor enim. Proin eu gravida nulla. Etiam pharetra ornare scelerisque. Nullam faucibus arcu eros, nec ullamcorper enim vestibulum vel. Nullam vitae erat eleifend, euismod leo nec, vestibulum tortor. Ut id lacus quis leo cursus ultrices. Vivamus vitae nisl felis. Curabitur id massa vitae neque tristique pellentesque. Aliquam blandit vel augue vitae venenatis.

Now for the fun part! Equations!

There are multiple ways of creating an equation environment. For a single line equations use: \begin{equation}, end with \end{equation}, but for a longer equations and proofs use \begin{align}, as explained in the beginning of this tutorial. In this environment, you choose where the equation will be centered by using &. Just write it in front of a character you would like to center against. E.g. f(x) & = a + b + c will center around the equal sign. For basic function like fractions and square roots google the exact command when you need it. No need to learn everything the first day. One thing you will use is a new line \\ you can place it everywhere and the text, or equation will be separated there.

\begin{align}
    f(x) & = \frac{(e^x-1)}{x} \\
    f'(x) & = \frac{(e^x-1)'x-(e^x-1)x'}{x^2} \\
    f'(x) & = \frac{xe^x-e^x+1}{x^2} \\
    f'(x) & = \frac{e^x(x-1)+1}{x^2}
\end{align}

Note that the lines will be numerated, to undo that just add '' after the align in the begin command. `\begin{align}`

In the next part of this I will talk a little bit more about text manipulation and graphic in the document.

Have feedback on this post? Let @andreicek know on Twitter.

Want to talk about this over email? Contact me.

2u ESXi 5.1 AMD whitebox server

As a software engineer I don't have any real connections to the "hardware" world in my studies. But I saw an opportunity to get some hand on knowledge in server/client visualization. I choose VMware because I have some experience in their end user software. This is the hardware that I will buy:

| Hardware | Price (USD) | |----------|------------:| |INTER-TECH IPC 2U-2312L /w power supply|262| |INTEL EXPI9301CTBLK|48| |AMD FX-Series X8 8320|205| |Asrock 970 Extreme3|97| |DDR3 8GB (1x8GB) Kingston, HyperX Blue x2|215| |Thermaltake Contac 30|46| |TOTAL|873|


Edit:

Once everything arrived I set up the box, installed ESXi 5.1 (support for INTEL EXPI9301CTBLK was dropped on ESXi 5.5 and I had to slipstream 5.5, and I had no time). I had to add a graphic card, and by friend recommendation I went with ASUS 5450. Also, being lucky guy I am, I got borrowed two Cisco routers (more about this in next posts).

The diagram of my network is as follows:

Network diagram

More soon.

Have feedback on this post? Let @andreicek know on Twitter.

Want to talk about this over email? Contact me.

Referendum about gay rights in Croatia

Posted on my old site - 28 Oct 2013. Original title: Why is a referendum about gay rights a bad idea? And, why is any kind of referendum about human rights truly a disaster waiting to happen?

Today (28. 10. 2013.) Croatian federal constitutional court ruled that if a referendum is held the saying of Croatian people is going to be final. Now, you might say, this is true democracy in its purest form. False.

By the definition a referendum is:

... a direct vote in which an entire electorate is asked to either accept or reject a particular proposal. (...) It is a form of direct democracy. -- Wikipedia

What that actually means is that a majority rules the minority. In other words we might find that if we gave the people the rights to change basic human rights we would have a closed minded society with a lot more problems than a gay marriage could ever do. (And really, why anyone would think gay marriage is a problem is beyond me.)

We might find that children with any kinds of disability would be discriminated from schools, that people of other races would be "removed", etc. The list really just goes on and on. What this reminds me of, and I will be quite frank here, is pure nazism. Now it might seem that this isn't a threat because people will go out and vote to give rights where they are due, but allowing this referendum is showing that basic human rights are subject to change and that is not acceptable.

I urge you to vote so we, the Croatian people, show that we are also a modern society. I also urge you to let everybody know that in future this kinds of questions are not in fact public and are not to be decided by public too.

To Croatian government I would just want to say, as a political party colleague, to never give this referendum a green light to prevent a disaster in the long run.

Further reading:


In early sunday morning we went back one hour. Will we 01.12. go back in past for 100 years?


This isn't what I usually write about, but I thought that this needs some exposure. As always I am open for communication crnkovic.a.z (a) gmail.com. Also fell free to leave some feedback on Reddit.

Have feedback on this post? Let @andreicek know on Twitter.

Want to talk about this over email? Contact me.

Creating new keyboard layouts

Need for this came with the need for a new school laptop. In November this year I am traveling to Zürich, Switzerland and I will be buying my girlfriend an myself a new MacBook Airs for school. Now we all know that "third" world countries like Croatia tend to price up all products known to people so we decided to save up some money for future use and buy our laptops there. Even with an airplane ticket, room for two you still save up quite a lot!

Boom! Surprise, well not really but we didn't think about this before, they don't use the same keyboard layout as we do! Deal breaker worth 1000€? Nope. I created my own mix from two keyboards. What were the prerequisites?, I hear you ask.

  1. To have our local letters on it: Č, Ć, Ž, Š, Đ
  2. To not be so different form the printed layout on the actual keyboard
  3. To have the @ sign placed at it's own key and the same thing for `

I installed Ukulele, a very old software that still works and does the job with so much ease that this was kind of fun to do! I also created a swell little icon for the keyboard in case you like to have the language icons showing.

The manual and readme you can find on the projects gist page, or down below. And now the obligatory gif (/ˈdʒɪf/) featuring the keyboard layout with all of its modifiers:

Animated layout

Installation procedure

  1. mkdir ~/Library/Keyboard\ Layouts (don't worry if folder already exists)
  2. cd ~/Library/Keyboard\ Layouts
  3. wget http://git.io/fIhuTQ --no-check-certificate
  4. wget http://andreicek.eu/images/Swiss_Croatian.icns
  5. Log out and log back in
  6. Add the keyboard using the Language & Text menu from Settings
  7. DONE

Have feedback on this post? Let @andreicek know on Twitter.

Want to talk about this over email? Contact me.

Hubot on Campfire with Heroku

Setting up Hubot should be a piece of cake, but sometimes it can be time consuming. But after spending my day in trial and error I finally did it without much problems after all. First things first, this is what you will need in advance:

  1. Campfire account (free or paid) for you and for your bot
  2. Heroku account (enter payment information up front in settings)

Dependencies

You will need installed: git, ruby, node.js and npm. If you are reading this there is a good chance that you already have git installed and for ruby the stars look good too. So you will need to install the last two.

First of all you will have to install Heroku gem application (or script?):

gem install heroku

Next using brew you will install node.js:

brew install node

And for the end install npm:

curl http://npmjs.org/install.sh | sh

And now for the star of the show, we install hubot along with coffeescript using npm:

npm install -g hubot coffee-script

Done, we have everything installed!

The actual setup

When we have every thing up and running we will create our own hubot! Now navigate to some folder that you won't delete in your spring cleaning after a month and run:

hubot --create myhubot

(Replace myhubot with your own name for it.) This will create a folder with your own name and robot. Now for last few touches. Edit the Procfile in the folder and replace several parts to make this as good working as possible.

web: bin/hubot -a campfire -n Hubot

Replace web with anything else than app (it can be your robots name) and then replace Hubot with your robots name. Now the application, once it is on Heroku, will operate as intended.

Deploying to Heroku

"Upload" to Heroku using git: (be sure that you are in the top directory of your hubot robot!)

git init .
git add .
git commit -m "initial commit"

Now create your Heroku application, replace hubot again with your robots name.

heroku create hubot --stack cedar

And then push the directory to heroku:

git push heroku master

Also since some scripts use Redis it is a good idea to install it now on Heroku. This is still free!

heroku addons:add redistogo:nano

Done!

Configuration (last step)

You will need the API key from the robots Campfire account settings, room IDs that you want your hubot to listen in (found in the URL of rooms) and your domain username eg. username.campfire.com. Also you will make your user the admin of the bot. Enter this commands one by one. Replace the examples with your own data.

heroku config:add HUBOT_CAMPFIRE_TOKEN=apikey
heroku config:add HUBOT_CAMPFIRE_ROOMS=roomnumber
heroku config:add HUBOT_CAMPFIRE_ACCOUNT="username"
// Be sure to enter your name exactly how it is in Campifre, with capitals and spaces, and everything!
heroku config:add HUBOT_AUTH_ADMIN="Your Name"

Running the robot

Now we are almost at the end enter the room that you told your robot to be in and enter this last few commands: (Remember to use your own proccess name form "The actual setup" instead of process!)

heroku ps:scale process=1

And check if the robot is running: heroku ps. You are done! If you have any questions don't hesitate to ask me in the comments or however you want. Your robot should be joining your room and now you can script him, or use him as he is. Have fun.


I used this great resources to compile my own tutorial:

Have feedback on this post? Let @andreicek know on Twitter.

Want to talk about this over email? Contact me.

Google trends screen saver Mac

Surfing Reddit I found a nice little animation of popular search terms on Google. Looking at it how pretty it was I wanted it as a screensaver. There is a tutorial on how to do this on Windows too, just Google for it.

This is now outdated and there is a better way. Check this out!

This uses Google Trends. Click on the visualization image to get started.

Google Trends site

An animation will start with just one field. You can have more of them on the screen by clicking the little squares in the left top corner of the website. Here you can select just how big the table is going to be.

Google Trends customization

Now copy the link of the website. It should look something like this: http://www.google.com/trends/hottrends/visualize?nrow=3&ncol=5&pn=p1.

Having done this you can go ahead and download the latest version of WebSaver for OS X. Install it and head over to "Desktop & Screen Saver" option in Preferences. Select WebSaver and click the "Screen Saver Options...". Unclick all other options and enter your URL in the field.

WebSaver

Now you are done! Let your computer idle a little and admire your new screen saver. Just remember that this will need a non stop working connection to work, if the connection is not present it will display a black screen.

WebSaver Google Trends screen saver

Have feedback on this post? Let @andreicek know on Twitter.

Want to talk about this over email? Contact me.