Category Archives: Life

Linux Cheat Sheet

Every once in a while you encounter this edge scenario that requires some specialized knowledge. And let’s face it, it’s always nice to find a quick cheat sheet with “recipes” for common (and sometimes less common) problems, than having to RTFM for hours, trying to find the solution.

So I decided to list the common problems I’ve encountered, and the solutions I found for those problems that have actually worked.

Deleting a massive number of files

Sometimes a directory full of old session files (maybe left behind by some php script) can be a real pain, especially when you’re trying to rsync or backup that site. Sometimes there are so many files in that directory, that an rm -rf * will return an error about the argument list being too long. The problem here is the usage of the asterisk (globing), which produces a huge list of files. To understand the effect of * just type this in a directory with some files: echo *

The following command will help you:

find /session/directory/ -type f -delete

Or if you want to erase only sessions that are older than 5 days:

find /session/directory/ -type f -mtime +5 -delete

Note that if you add -name sess_* you will stumble into the same globing pitfall mentioned above.

 

Converting from ext2 to ext3 and back

Nobody will judge you for choosing to use the ext2 filesystem, a real expert uses the tools for the job. In this case, the expert would make a calculated decision to trade safety for performance. Not having to write a journal could boost performance, but not having a journal could pose a problem during data recovery. However data recovery might not always be a concern.

This conversion process will not result in any data loss, and should be fairly quick even on large drives.

The process for ext2 -> ext3:

  1. Unmount the ext2 partition
  2. tune2fs -j /dev/sdb1
  3. Edit /etc/fstab and change ext2 to ext3 for /dev/sdb1
  4. Remount your ext3 partition

 

Hard Reboot on a semi-dead machine

Yesterday I found myself still logged into a machine that was stuck in a semi dead state, due to data corruption on one of the drives. It was impossible to reboot the machine using the conventional methods, and I had no IPMI or KVM for this old server, which meant I had to rely on a technician to physically press the reset button. But it turns out there is another way, and if you find yourself in a similar situation with root access to a barely functioning machine, you might want to consider the REISUB process, which uses the SysReq kernel feature as described in this wonderful Wikipedia article about the Magic SysRq key.

The short version is this:

echo 1 > /proc/sys/kernel/sysrq  # Enable the SysRq feature (just in case it's disabled)
echo s > /proc/sysrq-trigger     # Sync: Write all buffers to disks
echo b > /proc/sysrq-trigger     # Reboot the machine

 

MySQL Dump with Broken Views

So you decided to dump a database, either as backup, or to transfer it to another machine. But you get one of the below errors:

mysqldump: Couldn't execute 'SHOW FIELDS FROM `funny_table`': View 'silly_db.funny_table' references invalid table(s) or column(s) or function(s) or definer/invoker of view lack rights to use them (1356)

mysqldump: Got error: 1449: The user specified as a definer ('silly_db'@'localhost') does not exist when using LOCK TABLES

Fear not, you can dump it with this command:

mysqldump --force -uBob -pSecret --single-transaction silly_db > silly_db.sql

You will still get some warnings or errors but you can probably safely ignore them. What’s happening here is that something or someone left behind some Views that refer to tables that no longer exist, or to tables that exist but with fields that no longer exist. Some wordpress plugins have bad hygiene habits, and do not properly clean up behind them (hey, just like some people!).

Reading BIOS Events

Sometimes there’s a problem with your server harware. But if your machine lacks IPMI or DRAC, how do you know what’s wrong with the hardware?

Luckily, the BIOS will in some cases log some of the hardware faults in its BIOS Event Log. But how do you get to it from the comfort of your couch? dmidecode to the rescut.

In debian / ubuntu, just apt-get install dmidecode and then run:

dmidecode -t 15

This will show you the last few errors in your event log. Maybe an ECC Memory error, which might indicate your memory modules are faulty (as happened to me).

 

Elon Musk, Mars Colonization, and me

Imagine you have lots of money, what do you do? Do you give it all to charity? Do you keep it until you’re 80 and then let your children fight over the will? Do you perhaps setup trust funds with altruistic goals, that end up eating most of the money for management overhead after you’re dead? (hey, execs need their bonuses, right?).

What I like about Elon Musk’s choices and initiatives is that he’s putting his money and energy into humanity’s future. He is not investing in its present or past problems, and he is not getting his hands dirty with politics.

What I realized today, is that if I had all that money, I would probably want to join him as a co-investor, and at the very least, I would try to get involved into one of the projects, even if just to help him reach his goals sooner.

I think of the countless times in my childhood when I really wished I could travel to the distant future. I did not like what I was seeing around me as a child engrossed in Science Fiction books that described partially utopian futures. I spent a lot of time thinking about how far I would have to travel into the future until I reached an era that might be to my liking. I figured at least 200 years into the future until most resource and religion wars are behind us, and the majority of humans have evolved enough to become decent human beings, with advanced, friendly philosophies that promote exploration, science, and simply being good to others (humans and non-humans).

What Elon Musk is doing is admirable because his actions bring this future into our present. This is the kind of atmosphere I want to live and work in. When you actively build the future, you invite it into your present life, and you become part of that future as much as that future becomes part of who you are. And let’s not neglect the gadgets: When you build futuristic gadgets, you live in the future right now.

This makes me want to focus even harder on my own business venture, with the goal of making enough money to be able to join Musk’s adventures.

Let’s hope I succeed! But whether I succeed or not, I am at least proud to belong to a species that produces people like Elon Musk, who are constantly pushing the envelope. They stay a tree is as tall as its many branches, I say the tree is tall as its highest branch / leaf / flower.

 

Music re-discovery

A couple of months ago I upgraded my internal laptop drive to SSD. I’m very happy with the massive performance increase and the physical reliability. However, since the SSD drive is significantly smaller than my old magnetic drive (160GB vs. 512GB) I decided not to copy over any of my old music. This saved me from transferring almost 50gb of data.

The main reason for this decision was that I probably stopped listening to more than 50% of that music. I saw it as an opportunity to start from scratch, and only copy one artist at a time from my old collection, and only if I am reminded of them and really want to listen to them again. Another decision I made was to only transfer the tracks I liked (I made one exception so far with Yellow Submarine, because I love absolutely each and every track in that album). This would save tons of space, and increase the chances of enjoying a random playlist.

The first ones to make the move were: Kraftwerk, The Smiths, The Advent, The Beatles, and a bunch of Ambient tracks (Brian Eno, Steve Roach, Aphex Twin, Vidna Obmana, Zegunder, William Orbit, etc).

I am thoroughly enjoying the experience, and recommend it to anyone wishing to rediscover the music they love.

New York, New York!

It’s hard to believe I’ve been living in New York for 16 months now! It’s truly mind blowing how eventful it’s been so far. In the space of 16 months I managed to get a divorce, I created my first US corporation, acquired a major customer, moved my Israeli business to the US, dated 20+ women in search of a new partner, found an awesome apartment in Long Island City and slowly furnished it (from scratch!), found an absolutely amazing woman and fell in love, got married again, am planning a wedding celebration (which will happen in November), launched am amazing startup and getting ready to work on another, and probably quite a few other things I neglected to mention.

I like this city very much. I always knew I like New York; Some of you may remember the story of the first time I returned to Israel from New York, and how depressed and empty I felt for a few weeks. I knew that some time in my future, I would love to live in this great city for at least a year of my life, and now I have not only realized that dream, but am in the process of realizing many other dreams!

I know how some New Yorkers have this love / hate relationship with the city, but one can only speak for himself; I can definitely say after living here for 16 months that my love for this city has evolved and become more substantiated, like good wine aging in a barrel.

You slowly but surely learn where to go that suits your mood at the moment. And this is where New York shines: There’s a place for every mood. If you want a crazy party, it’s there. If you want cheap trashy food, it’s there. Want classy, expensive food? It’s definitely there big time. Want classical music? It’s there. For money? Sure. For free? Sure, there’s free stuff too! Parks, Hotels, Palaces. Real life, Fake life, Real people, Fake people, Neon lights, Drunks pissing in the subway, People buying mangos and drinking beer illegally on the beaches, Lounging in a roof pool in a hotel with a crowd that’s 80% LGBT, listening to great music, dancing on the beach with total strangers, watching free movies in Bryant park, attending the infinite number of seasonal parades (Mermaid Parade, Caribbean Parade, Gay Pride Parade, Macy’s Parade, Israel Parade, etc.), the alternative crowd of St. Marks, the cheap vegetables of Chinatown, the tens of thousands of restaurants, bars and pubs, the amazing stores (shopping capital of the world!), and the list goes on.

This is all made even better by the fact that I have siblings and many friends in the vicinity. My dear brother leaves in Brooklyn, and my sister is not too far away in Philadelphia. I have friends in various boroughs, and other friends in other states. All of a sudden the US feels a bit more like a home to me. I feel like I’m starting to settle down again, and it feels good.

As an added bonus, New York turns out to be quite a hub for many, mostly for business, but also for pleasure. I have already had the pleasure to meet many friends who flew to the city for various reasons. This is another advantage of New York: When you are out in the city with friends, the city smiles at you, and you smile back at the universe and say, thank you, dear universe, for this wonderful time!

From Russia with Love?!

When I was very young, Russia was this “grey” and “evil” entity. Having lived in countries mainly under the influence of the west, this is no surprise. The impression was that the government is not very good for the people, as in, not very democratic.

However this is my third or fourth time to Russia, and what I discovered has changed how I think about countries and governments in general.

The first thing that shocked me was how popular virtual money is. When you are in the wallet business, you learn that in Russia the most popular valid form of payment is “Webmoney” but the reality is that many russian companies have wallets! What really matters, is that you can walk a short distance from your home and convert your real cash to virtual cash, with which you can then pay for services online. For that, a rampant network of money collection terminals exists, with fierce competition in some areas. The machines only take money, and produce a receipt.

In some apartment buildings the machine is in the lobby so you can go downstairs in your PJ’s and convert money to virtual value without braving the elements (visualize the Moscow winter to realize how practical this is!).

What makes this business thrive in Russia and Ukraine? What is the government doing or NOT doing, which allows wallets to be so popular? Is it the lack of trust in Russians banks? Is it some Russian cultural trait?

I welcome your feedback on this one.

Single again!

As Forest Gump’s Mother said: Life is like a box of chocolate. You never know what you’re gonna get. Aren’t mothers amazing?

I won’t get into the reasons here, but the plain and simple truth is that as of last Sunday, I am officially divorced. Since I married religiously according to the Jewish Faith, I also had to divorce the same way.

Just to clear up some confusion – I have not seen my ex-wife for 9 months. It just took forever to do the procedure, due to many factors (some of which are related to travel, some because my ex is in Israel and I’m in the USA now, and some just related to bureaucracy and logistics).

The procedure was quite elaborate! There were 3 rabbis who acted as “Judges”, one of them doubling as the Scribe (The “Sofer” in Hebrew, who is normally a separate person) and also as my first Witness, and yet another Rabbi, this one was to be my second witness (According to the Jewish Faith, you are supposed to have two witnesses when you sign your Marriage Certificate, and also two witnesses when you sign your Divorce Certificate).

There were 3 potential complications in my divorce:

  1. The fact that I am in the USA, and my Marriage records + ex-wife were both in Israel. This meant the Rabbis needed to communicate with the Israeli branch, and this took a considerable amount of time. However, fortunately, it eventually happened and I received a call summoning me to sign my Divorce Papers.
  2. If there’s shared property or children, or some disagreement between the sides, the judges would have to intervene and judge according to Halacha (Jewish Law). Fortunately, our decision to divorce was mutual, there were no children, and no shared properties that were under any kind of disagreement.
  3. The procedure itself, which is quite elaborate. The Rabbis must make sure you will not retract your request to divorce, and that you were not forced into the divorce, or paid money to divorce, and that no threat of violence is placed on me, etc. Fortunately none of that is true, and the divorce was allowed to happen.

I followed the ceremony, which I have to note, was wise and obviously carefully worded, in what I assume is the result of a few millennia of learning from bad experiences…!

Another interesting point, is how your parents are identified. I had to call my parents during the ceremony, so that the Rabbis can verify with them what they are called, by their community and/or circle of friends. It turned out this was not without merit, as my dad goes by 3 or 4 different names!

Following the conclusion of the ceremony, the Writer (“Sofer”) must go about his business, which is to write the Divorce Papers in my name. Once that was done, a courier was designated (turned out the Writer was also the Courier…). I had to task him with the job of notifying my wife that she is now no longer my wife. He accepted the task, and the ceremony was concluded.

Story: Ukraine to Russia via Belarus

But First, Moscow

The following story happened to me about a year ago, during a business trip to Ukraine. The purpose of the trip was to visit a team of engineers I work with remotely. I was staying in St. Petersburg at the time, but there was no Ukrainian embassy in St. Petersburg so I had to travel to Moscow.

Plans were made, and I travelled to Moscow by train, using the new high-speed “Sapsan” train. The journey was wonderfully smooth, and lasted 4 hours.

Once in Moscow, I located the Ukrainian embassy where I waited for hours until I finally managed to get a Visa to visit the Ukraine. It may have taken longer if not for my friend Igor who is kind of a Russian celebrity; The lady who takes care of Business Visas recognized him, and with his verbal skills he managed to coax her into being especially helpful. The Visa I was granted and was a “One Time” thing, meaning I could enter the Ukraine once, but if I leave it is stamped out and can no longer be used, even within the valid period. I mention this because it becomes relevant later in this story.

Igor took me to the train station the next day, where again I stood in line for hours to buy a train ticket. It was an especially hot summer day. Hundreds of sweaty, tired Russians, Ukrainians, Armenians, and various other tourists and backpackers were all crammed together in the same space, waiting for the staff to start their shift. Once available, things started moving fairly quick, and I managed to obtain a ticket 20 minutes before the train was scheduled to leave.

Moscow to Vinnitsa

The journey to Vinnitsa lasted 18 hours, which isn’t too bad considering the ride is super smooth, quiet, and you get a bunk bed with clean sheets. I shared a room with two old ladies, and a charming young lady. This woman bought a bag full of beer, and dried salmon. During the trip we connected and exchanged music, stories, and she insisted on giving me half her beer. So I was half drunk the entire way to Vinnitsa!

Vinnitsa itself was beautiful and pastoral. Green grass, birds singing, beautiful women, a relaxed atmosphere, and they even have a mini-mall complete with electric stairs and air conditioning. Night life was quite interesting as well, with some “posh” clubs that offered international music and special payment cards you had to buy at the entrance.

Time to leave… Vinnitsa to St. Petersburg!

With my visit to Vinnitsa concluded, it was time to get back home to St. Petersburg. The office administrator in the company I was visiting offered to help me buy the ticket, since I did not speak Russian. I agreed, gave her the cash, and used the extra time to spend more time with the team in the office.

The journey back was supposed to last more than 20 hours. I didn’t understand why the journey was longer, since the distance to Moscow was greater, but I didn’t mind. I bought some food for the journey and was taken to the train station. I said my goodbyes to my hosts and boarded the train.

A couple of hours into the journey, We reach a checkpoint. Ukrainian border police get on the train, and start to stamp passports. My Ukrainian Visa was stamped and was now no longer valid, but who cares, right? I’m going to Russia, and I no longer need it. With the border police off the train, we continue our Journey towards Russia, or so I thought…

Around 4 hours later, we reach another checkpoint. This time, I assumed, I would encounter the Russian border police, and I prepared my Israeli passport (Israelis do not need a Visa for Russia). The police officer asks me some questions in what seems a weird Russian dialect. I didn’t know how to answer his questions so he searched my Passport once, twice, looked at me, searches the passport a third time, and then gave me an angry face, and cross his arms to make a big X to convey that I can not enter the country he is protecting with his life.

I look in disbelief, and ask why not? He says “Nie Visa”, which means “No Visa”. I tell him I don’t need a Visa, and he says this is Belarus! I was asked to leave the train, which was not the best feeling I have to admit! As I pack my stuff and get off the train, the implications of a horrible mistake start to dawn on me: I have foolishly allowed a train ticket to be purchased for me, that does not go directly to Russia, but does a detour through Belarus first. Needless to say, I did not have a Visa for Belarus, and having left Ukraine just 4 hours earlier, I did not have a Visa for Ukraine!

My passport was taken, and I was asked to wait for the next train back to Ukraine. While waiting for the train, a local Belarusian country girl almost convinced me to marry her. I showed my wedding ring a couple of times (which did not help as much as I’d hoped), and I managed to resist. We smiled to each other in understanding, and everything was fine again. Another 4 hours later my train arrives, and I am escorted by the Belarusian border police (who by the way were extremely nice to me). They spoke to the controller and explained the situation. I was given a seat, and we began our journey back to Ukraine.

Stuck in Limbo!

We arrive to the first Ukrainian checkpoint again, where I again encounter the first Ukrainian Border Police. They look at my now expired Ukrainian Visa, and ask me to get off the train. The situation is bad: I am now in Limbo – Unable to enter the Ukraine, and unable to enter Belarus. Stuck between worlds. It is in such a moment precisely, that you wish governments didn’t exist, and that political borders would finally cease to exist.

The two officers who got me off the train gave me sad faces, and conveyed to me the situation was dire, but that their boss would know what to do, AND assured me he also spoke English! So there I am, waiting patiently for their boss to save me, as I looked on sadly at the train resuming its journey into Ukraine without me.

Ukrainian Bak-shish…

So the checkpoint boss finishes up the paperwork for the train that just left, and finds some time for me. He repeats what his soldiers told me, that this is a complicated situation, and that they don’t really know how to deal with it. He assigns a very tall Ukrainian soldier to stand next to me wherever I go. She’s very pretty – In New York she would probably make a top model, but she’s a soldier and sports a serious face that means business…

The boss goes into their main complex, supposedly to discuss my fate with a group of officers. Meanwhile I wait outside, near the checkpoint’s exit gate. Beyond the gate, the last few Taxis take people who disembarked from the train to their homes. I find myself wishing I could do the same – Just go home, shower, and lay in bed for 5 days straight.

Finally the boss comes out, and asks me, how much money do I have? I tell him I have very little money on me, in an attempt to stave off any exaggerated bakshish requests… he looks at me severely and goes back into the complex. At that point, the driver of the last remaining Taxi approaches the gate. He looks at me and smiles, and starts talking to me. He asks if I’m in trouble, and if I need help. I tell him yes, and tell him what happened. He tells me he knows exactly how to get me out of this tight spot, and that he will help me.

I’m thinking, what’s the catch? Where I come from, you learn to distrust Taxi drivers, and that they are just after your money. But something told me there was something interesting and different about this Taxi driver.

So I ask him what to do, and he starts giving me very clear instructions: Go to the Boss, tell him Vladimir will take you to the Airport in Kiev. Ask to talk to Igor, and pay him 1500 Rubles to eliminate any paperwork mess. Then pay me 2500 Rubles for the Taxi ride. They know me and trust me. Go, and good luck.

I do as he says, and the Boss says, Ah, Vladimir! Very good. You want to talk to Igor? Sure! Go to this corridor, turn right, then last door to the left. I knock on the door, walk into that room, and find a smiling man in his 30′s. He understands I’m not a Russian speaker, and that excites him to no end. He decides to practice his English with me, when all I want to do is get the hell out of there. We talk for almost half an hour. At some point I just stick the money on his desk, indicating I want to get down to business. He gets the hint, fills some paperwork, and lets me go, not before holding me again at the door for another 5 minutes to practice a few more sentences in English…

I go back to the gate, say my goodbyes to the checkpoint boss, who exchanges a few words with Vladimir the Taxi driver. It becomes apparent they know each other quite well, and that the checkpoint boss has a LOT of respect for Vladimir. The gate is opened for me, and I feel a huge relief when I put my bag in the Taxi and sit in the front seat.

The ride to Kiev (through the Forbidden Zone!)

On the way to Kiev, Vladimir tells me a few surprising facts. It turns out he is married to the mayor of that town. It also turns out he was the previous checkpoint Boss, and that the current boss used to report to him. I start to connect the dots; Suddenly it’s all clear to me, how Vladimir knew the procedures, knew the people by names, and knew exactly how to get me out of my situation.

He goes on to tell me that it’s already late evening, and the drive to Kiev takes normally around 4 hours, and do I mind if he takes a shortcut, and that it will save 2 hours. I tell him sure, shortcuts are fine with me – as long as we get there. Little did I know that the shortcut involves traveling through the forbidden zone around Chernobyl.

We approach a checkpoint to the forbidden zone, whence a checkpoint soldier stops us. He approaches the car suspiciously, but then he recognizes Vladimir he stands to attention and salutes him(!). They exchange greetings and the soldier runs back to open the gate. We enter the forbidden zone, and I get a strange feeling that maybe I should not have agreed to this shortcut, but on the other hand I was also curious and excited.

We drive insanely fast in Vladimir’s old Lada Taxi in the forbidden zone, on surprisingly good roads. The asphalt still relatively dark and crisp. The roads are completely deserted. I ask Vladimir about this and he says the roads are great because nobody drives on them, so the roads do not deteriorate. Obvious signs of neglect can be seen off road, however, with plants growing wildly everywhere, including in buildings, from within windows or from cracks in the walls. The buildings are all dark and abandoned, giving the zone an eerie zombie-land feeling.

We then talk about family, and he asks me if I’m married, I tell him that I am but I have a brother in America who is not yet married and looking. He tells me if my brother wants, he can organize a “bridal event” for my brother. Basically, my brother would come for a week to Vladimir’s village. There would be an event where beautiful potential brides and their parents would participate, eat, drink and make merry. At the end of the event, my brother would choose a bride among the women, they get married, and leave back to the US. I took Vladimir’s number, and promised him to convey this idea to my brother.

After a long half hour of avoiding the subject, I ask Vladimir about the radiation. He laughs and says not to worry about it. You only get dangerous levels of radiation if you live in this zone for many years, he adds. But for the 45 minutes we’re spending on the edge of the zone, it’s practically safe. I decide to let the subject rest, as I relax into my seat.

When we reach the end of the forbidden zone, we are let out through another gate, and 5 minutes later, we reach a very strange road side hunters restaurant and gas station. We stop to rest, and I buy Vladimir two cans of Redbull per his request. I take some photos of the restaurant, which was chock full of stuffed animals that were hunted in the forbidden zone. Their eyes and teeth were painted red for the dramatic effect…

Finally, Kiev, and a Flight to St. Petersburg

We leave the strange restaurant, and within 45 minutes we are in the airport in Kiev. Vladimir helps me into the airport with my luggage. I pay him, we hug, I wish him a safe drive back and we say our goodbyes.

The airport has Wifi, and I pull out my laptop and start looking for flights to St. Petersburg. I can’t find anything for a reasonable price. Finally, I decide to try the sales agents in the airport. They are all closed except for one! I approach the lady in the counter, and enquire about a flight to St. Petersburg. She runs a query and finds a very last seat on the last flight to St. Petersburg, and tells me I’m very lucky. I buy the ticket, go through security, and 3 hours later I’m on a flight back to St. Petersburg.