2015-06-02 Low Contrast

Just stop that, guys. Unreadable text does not make your website look cooler.

http://contrastrebellion.com/

Ironically, this website has a low contrast. It seems like it is acceptable for black backgrounds? White text on black background shines like a light bulb, you do not want that.

Comments

2015-05-26 University in the Butt

In one of my previous posts (2014-09-27 Sand in the Butt) I mentioned my urge to do at least one commit every day. This lasted for quite some time, until the lack of resources actually made me skip one day. And then another one. And then a whole week… Well, take a look yourself:

File:2015-05-26-222442 737x292 scrot.png

I am not sure if I liked this experience of committing something every day. Yes, I was very productive during this period, but let's see if anything changes once I stop following this rule.

Somehow I feel that the current education system does more harm than good. I have not checked my sleep graph yet, but I will not be surprised if it was the worst time during the last two years.

Comments

2015-04-28 Penguins

Do hard work by marking as many of these cute penguins as you can.

http://www.penguinwatch.org/

Comments

2015-04-14 Switch Today, Switch Tomorrow

This page is being updated continuously.

Note: there is a high chance that you already know some of that stuff. In that case just skip to the next point, sorry for spending two seconds of your life.

Things you should start using today:

  • Use Matrix/Riot instead of Skype, Facebook, etc.
  • Look down. Do you know the meaning of every key on your keyboard? Home, End, Alt Gr? Ctrl+Arrows/Backspace/Delete, Shift+Arrows? If not, please educate yourself! You're using the keyboard every day, how come you don't know half of the functionality?
  • Look forward. Do you know why some letters on your screen are underlined? Hit Alt if you can't see it. Also, did you know that there is the same thing for web pages?
  • Look down again. Do you know why the letters on your keyboard are arranged in this order? If not, learn about the history of Qwerty layout and search for alternatives (Dvorak keyboard layout is a sane choice).
  • Have you ever caught yourself on repeating the same text editing action over and over? No more! Learn about advanced text editors (Emacs is a sane choice, but you may also try Vim).
  • Internet ads are annoying, especially on youtube. Install an ad blocker! (Adblock Edge is a sane choice, but it will be discontinued in favor of uBlock)
  • Are you still using !WinRar? Come on, we are over it for so many years (7-zip is a sane choice).
  • Do not send .rar files to others, please. Seriously. It is a pain to use.
  • Speaking of Win-things, there are enough better operating systems than Microsoft Windows. Learn about other operating systems and start using one (GNU/Linux is a sane choice, Debian in particular).
  • Haivng spell cheking tunred on makes your text look way better .You may also find out that you were writing smoething wrong for the whole life!
  • 360° is one turn, right? But where does the number 360 come from? Learn about gradians (400ᵍ is one turn) or use radians (2π is one turn).
  • Hold on, 2π? Why two? This does not sound right. Learn about Tau.
  • Have you ever thought about inefficiency of language varieties in our globalized world? It is pretty obvious that in the end there will be only one or two languages. Start using a popular language for your public works (research papers, blogs, documentation), even if you can't speak it flawlessly. Choosing one is not hard as well (English is a sane choice).
  • In some countries they will bring groceries right into your house for little or no price overhead. Start using it today and support it by all means, this is the future.
  • In most window managers Alt+Tab is very useful because it allows you to go to the previous window. This, however, does not work in browsers. Set browser.ctrlTab.previews to true in Firefox to get the same behavior on Ctrl+Tab. [1]

Some things are not ready today, but they will be ready eventually. You should keep an eye on these things:

  • Open up a calendar, can you explain why the months are arranged like that? 31 28(29) 31 30 31 30 31 31 30 31 30 31? Hint: there is no reason. Learn about other alternatives (International Fixed Calendar is a sane choice. Also, there is an episode of 99% Invisible about this).
  • Look at the clock. Can you spot a problem that is similar to 360°? Right. Additionally, one day is 24 hours. Learn why and search for alternatives (Decimal time is a sane choice).
  • A lot of websites are using HTTPS now. Learn why. However, paying for the certificate does not sound like a right choice. Keep an eye on https://letsencrypt.org/.
  • Gmail -- doesn't provide even a slightest bit of security. Encrypt everything today (unfortunately it is hard to setup)

And don't forget to be conscious. The problem with degrees, time and calendar could have been solved hundreds of years ago.

Comments

2015-03-17 Free Hardware

The bottom section of this post is being updated continuously.


In this post I will be calling it “free hardware”. It's a pity, but writing or pronouncing “Free Digital Hardware Designs” is just too much. Sorry.

There is a new article about free hardware by Richard Stallman, check it out:

http://www.wired.com/2015/03/need-free-digital-hardware-designs/

I am quite surprised that RMS wrote something about free hardware. Previously he stated that free hardware is a bit too much for him (not that it is a wrong thing, but we have to solve our problem with software first). Also, in one of his talks he pointed out that free software principles cannot be applied to hardware, and even said that it is a dumb thing to try to do so. And there is an article On “Free Hardware” (1999, by Richard Stallman) where he expressed some doubts about free hardware.

It is great to know that these things are being rethought. Perhaps the latest success of 3D printers makes us all understand that it is not too hard to share the design of something. However, I believe that free hardware is mostly about electronic devices and not 3D-printed solid objects in first place. That is, schematics and PCB layouts (and also firmware, but that's on the free software side).

So I want to make free hardware, how can I do that?

Luckily there is a plenty of software to help you with that.
Try Kicad! Works so great for schematics and PCB layouts. You can put your project files into git and it will work just fine. Don't expect complex merges to work (although they sometimes do). Most importantly, such approach allows working on the same project in a team, and you also get a history of every change since the beginning without too much of an overhead. Git is so great at storing the source code and since Kicad is using plain text files, the whole thing just works (although I have a feeling that it was not intended to be used with git).

We've been doing this for quite some time and we are pretty much satisfied. I know, it is a bit tricky for electronics engineers to get into git (since they are not programmers in the first place), but I believe that it pays off in a long run.

Thanks, Richard Stallman!

Previously it felt like doing free hardware is something weird. Hopefully it will get more natural after this article.

Here is our thumb up:
This logo suits free hardware much better than a broken gear.

See also a blog post by Olimex: https://olimex.wordpress.com/2016/01/13/open-source-hardware-oshw-why-it-matters-and-what-is-pseudo-oshw/


List of lists of free hardware projects

This list is being updated continuously.

It is such a pity that there is no unified list of free hardware projects. Let's list some of the lists:

Comments

2015-03-14 The Downsides of Free Food

This post was extracted from https://alexschroeder.ch/wiki/Comments_on_2014-06-23_Oddmuse_Migration

It all started like a simple bash refactoring, but look! This time was special because someone decided to post a link to google style guide and claimed that it is a "nice resource". Well... I just had to explain everything. At first, I didn't think that my answer is worth a blog post. But hey, it seems like a lot of people worship these guides... So I decided to extract it into my blog.

I suggest you not to read their guide

It is plain bullshit.


Well, I can quickly go through most of the mistakes:

for dir in ${dirs_to_cleanup}; do

Clearly $dirs_to_cleanup is not quoted, this indicates that there is something wrong. Better use array and "${dirs_to_cleanup[@]}".

Also, what is the point of using curlies like ${var} everywhere??? They'd better teach to put quotes everywhere. Such style is propagated only by Google style guide (a guide written by people who think that you're stupid enough not to understand the two exceptions when ${} is actually required, but at the same time these guys don't even know how to quote variables correctly). If that made any sense then we would be doing the same thing in perl and php, but we don't.


rm "${dir}/${ORACLE_SID}/"*

That's rm without -- . Well, not a huge issue, but that's a styleguide or what?


if [[ "$?" -ne 0 ]]; then

Funny. Left side of the expression is quoted when it does not have to be. But even if it had to be quoted, what would be the benefit to quote $? ? It is always an integer. Oh, and if it is an integer, then it would be better to use (( )) for arithmetic expressions, like: if (( $? != 0 )); then


case "${expression}" in

Does not have to be quoted, actually, but at least it does not hurt.


while read f; do
  echo "file=${f}"
done < <(ls -l /tmp)

WHOA! Holy sh...!!! That's amazing... Bash pitfall #1, parsing ls, read without -r. It just couldn't be worse.


# -z (string length is zero) and -n (string length is not zero) are
# preferred over testing for an empty string
if [[ -z "${my_var}" ]]; then
  do_something
fi

But hey, it is as simlpe as if [[ ! $my_var ]]; then , why would they complicate things so much?


# Instead of this as errors can occur if ${my_var} expands to a test
# flag
if [[ "${my_var}" ]]; then
  do_something
fi

What??? Which error?? Am I missing something?


zip_version="$(dpkg --status zip | grep Version: | cut -d ' ' -f 2)"

A rule of thumb is that you should never pipe any of these commands together: sed, awk, grep, perl, cut and some others. The reason is that we usually need such functionality that is present in most of them, and indeed with a little trickery these tools will usually do each others' job. However, they use completely different approaches.
In this particular case you can use grep with -P flag (perl regexes! Woohoo!). Like this:

zip_version=$(dpkg --status zip | grep -Pom1 'Version: \K.*')

But there are other solutions as well.


if ! mv "${file_list}" "${dest_dir}/" ; then

Just look at that variable. It says "file list". Aha, sure, this would definitely work.


addition=$((${X} + ${Y}))

Stupidity all over the place. This should be:

((addition = X + Y))


At least that "$file_list" example will give me a good laugh for the next few days. 😂

Maybe they should stop eating their fucking free food and go through BashPitfalls instead?


Also, I feel like this post is lacking some image. Well, you can look at this image, if you wish.


(Originally posted on 2014-07-02 08:09 UTC)

Comments

2015-03-08 Bash Pitfalls

Bash is hard, but that's not an excuse.

Every time I see something like this:

<dity!>
  1. !/bin/sh
    read FOLDER
    [[ ! -d $FOLDER ]] && mkdir $FOLDER || printf "Directory $FOLDER already exists"
    echo $myVar > $FOLDER/log

echo Please copy your files to $FOLDER
read > /dev/null # wait for Enter

sleep 1 &

wget -Out http://link.org

if [[ $num1 > $num2 ]]
then
echo 'Error!'
clear
fi

PATH=data/stuff;
cd $PATH;

sudo echo $'Script started' >> /etc/mylog

echo "Math test: 0 + 2 = ${0+2}"

rm -rf $FOLDER


I feel horrible. It is like my insides are falling out! ARGH!

But this is not getting better at all!

Is it so hard to go through the list on BashPitfalls page? I don't think so. However, most people would much rather follow retarded Google style gu-fucking-ides than learn the language they are using.

I post comments like this from time to time:
https://alexschroeder.ch/wiki/Comments_on_2014-06-23_Oddmuse_Migration

But look, this time was special because someone decided to post a link to google style guide and claimed that it is a "nice resource". I've extracted my comment into 2015-03-14 The Downsides of Free Food, please check it out.

Is there any hope?

Yes, get yourself a steel pipe.

Joking aside, lets start something interesting now! I will pick a pseudo-random open-source project every week (or at least every month) and refactor it. I will document everything on this blog. Later, if there are enough refactored projects and if this stuff becomes interesting to people, I will extract it to a separate wiki. Of course, every time I will do a pull request with all of the changes.

Although I try to make the code perfect, sometimes it is not possible to do it fully. Things for you to note:

  • Sometimes it is too hard to find out the purpose of some poorly-written dumbfuscated code, I might not touch such lines. There is a high chance to break stuff in such situations, and sometimes the behavior of edge-cases will change. I think that such lines could be dealt with later, when my more obvious changes are commited.
  • I don't want to spend too much time on one project, and I will not pick the same project twice. Therefore some possible changes might be left behind. Feel free to do some post-fixes yourself!
  • I'm not a Bash god, you will find much more experienced people on #bash, for example. This means that I might not be capable of fixing some tricky bugs.

The goal of this project is to spread the knowledge about bash pitfalls and improve the quality of open-source projects.

Please be conscious.

Comments

2014-09-27 Sand in the Butt

A lot of people ask me, "how did you spend your summer?". Well, here is how:

And what about you?

Yes, I had a lot more fun than those dumbasses who were exposing their bodies to the sun radiation.

Our bodies do not require such moronic activities.

Seriously, what's the point? Why would somebody want to do that? Some people claim that they require rest. Well, okay, a rest from what? That's a shitty excuse for your procrastination. My body requires constant intellectual activities and learning. Shame on you if your doesn't.

Hmm, maybe...

Maybe I can understand that if you were doing something useful for the whole year, you might want to take your female/male somewhere and spend a day or two together, just enjoying your lives and doing something fun and interesting. But shit, three months? That's ridiculous! And why summer? You can do that on any weekend.

However, don't take this graph too seriously.

It does not represent any precise information about my productivity (for example, it does not show commits to the projects that do not use github), but I still like that graph. I don't find it necessary to fill every block of the graph, it is just a good motivation to make at least something small every day. Sometimes I don't feel like doing anything at all, but after I make a few simple changes just to fill this graph, I get caught on it and end up programming for the whole night. Well, sometimes I don't, but even small changes to readmes and help messages or tiny refactorings are better than no progress at all.

Try it yourself!

Even if you're not a software developer, you can use that trick for anything else. Like "do at least one push-up every day" or "read at least one page of a book". You can keep the same graph on a paper calendar, if you wish. In that sense github is a bit better because it is more strict, it will not allow you to fill missed days without any dirty tricks.

Please be conscious.

Comments

2014-08-30 ALS Boobs Challenge

I was challenged by Anatoli Belski. Here is the video:

https://www.youtube.com/watch?v=CRidbVgKMoo

I nominate Steve Jobs, Osama bin Laden and Jesus Christ. Remember, you have only 24 hours.




While morally unprepared people from all over the world are washing their raw heads with cold water, I am trying to cope with my sadness about the disaster we are all heading for.

Sure, I am glad for researchers, scientists and thieves who will get this raised money, and I have no doubt that this is going to have a positive impact on ALS research too. But how is this going to help globally?

And why ALS? Lets look at what they say:

"It is estimated that ALS is responsible for nearly two deaths per hundred thousand population annually."

Oh, that's why it is so important.

Wait...

2/100000 ?

That's 0.002%, right?

Don't get me wrong, I am glad that some people who usually spend hundreds of dollars on computer games will now donate 10 bucks for ALS research. But I am not sure if this low-efficiency short-term trend will cause more benefit than harm in a long run. Just imagine, all these noncaring heaps of meat now have a justification for their lives. They've done something potentially useful, now they can peacefully procrastinate till their deaths. It is like no one can shame them anymore.

But shame is good. It makes us not to do silly stuff and for some people it is a great motivation to start doing something smart.

However, some people have no shame:
Surprisingly, all of these videos were removed. What a coincidence.
https://www.youtube.com/watch?v=4EnqAHbUViE – completely or partially naked chicks showing off their breasts
https://www.youtube.com/watch?v=54aWEQjSRwA – partially naked chicks showing off their breasts
https://www.youtube.com/watch?v=Y0UaUTdiSsE – partially naked chicks showing off their breasts

And some people are just plain stupid:
https://www.youtube.com/watch?v=WQlvW0aFnKo – lots of people hurting themselves. Because it is so damn hard to turn a bucket over.
https://www.youtube.com/watch?v=YEGZXT5SLvE – lots of people hurting themselves. Because it is so damn hard to turn a bucket over.

I thought that the days of chain letters are over, but it seems like I did not take into account that there is a new generation of youngsters who don't even know what is a "letter".

Please be conscious.

Comments:

Hahaha.

-- AlexSchroeder 2014-09-12 15:38 UTC

Comments

More...