HOWTO restart Cinnamon

Linux Cinnamon is a popular desktop environment used by many Linux users. While it is generally stable and reliable, like any software, it can sometimes fail or crash. When this happens, it can be frustrating for users who rely on Cinnamon to get their work done. In this blog post, we will explain why Cinnamon might fail and how to restart it when it does.

Why does Cinnamon fail?

There are several reasons why Cinnamon might fail or crash. Some common causes include:

  1. System updates: Sometimes, updates to the Linux system or other software can cause compatibility issues that result in Cinnamon failing.
  2. Hardware issues: If there is a problem with your computer’s hardware, such as a failing hard drive or faulty RAM, it can cause Cinnamon to crash.
  3. User error: Occasionally, a user may accidentally make changes to their system or Cinnamon configuration that cause it to fail.
  4. Bugs in Cinnamon: While Cinnamon is generally a stable and reliable desktop environment, it is not immune to bugs or other issues that can cause it to fail.

How to restart Cinnamon

If Cinnamon fails, the first step to take is to try restarting it. Here are the steps to follow:

  1. Press Ctrl + Alt + F2 on your keyboard. This will take you to a command line interface.
  2. Enter your username and password to log in.
  3. Type the following command to stop the Cinnamon process: pkill -HUP cinnamon
  4. Wait a few seconds, then type the following command to start Cinnamon again: cinnamon --replace &
  5. Press Ctrl + Alt + F7 on your keyboard to return to the Cinnamon desktop environment.

If Cinnamon does not restart using these steps, you may need to try restarting your computer or troubleshooting other potential issues.

In conclusion, while Linux Cinnamon is generally a stable and reliable desktop environment, it can fail or crash for various reasons. When this happens, it can be frustrating, but restarting Cinnamon can often resolve the issue. If you are unable to restart Cinnamon using the steps outlined in this post, you may need to seek additional support or troubleshooting resources.

Bonus track!

There is indeed a more straightforward way to restart Cinnamon. Here are the steps to follow:

  1. Press Alt + F2 on your keyboard. This will open the “Run Command” dialog.
  2. Type the letter “r” into the text field and press Enter. This will restart the Cinnamon process.
  3. Wait a few seconds for Cinnamon to restart. If everything has gone smoothly, you should be able to continue using Cinnamon as normal.

Using Alt + F2 and typing “r” to restart Cinnamon is a quick and easy way to get your desktop environment back up and running if it has failed or crashed. This method does not require logging in to the command line interface or typing any commands, making it more accessible for users who may not be familiar with the command line.

Advertisement

Resizing the Root Partition on an Ext4 File System: A Guide to Swapping Out Your Swap Partition

Have you ever run out of space on your root partition and wished you could make it bigger? Or maybe you had a separate swap partition that you wanted to get rid of? Well, fear not, my friend, because today we’re going to be diving into the world of resizing partitions and making the switch to using a swap file instead of a partition.

First of all, let’s talk about why this is possible. The ext4 file system, which is the default file system for most modern Linux distributions, allows for resizing and modifying the partition layout on the fly. This is thanks to the advanced features of ext4, such as its ability to handle online resizing and the use of an advanced journaling system.

Now that we’ve got the basics out of the way, let’s get down to business.

  1. Backup your data

Before you do anything, it’s essential to backup your data. You never know what might go wrong during the resizing process, so it’s always better to be safe than sorry. You can use tools like rsync or tar to backup your important files to another location.

  1. Disable swap

Before we begin resizing the root partition, we need to disable the swap partition. This is because the swap partition may be in use while we are trying to resize it. You might also need to remove it so that you can increase the boundaries of the resize you need. To disable swap, you can use the following command:

sudo swapoff -a

  1. Resize the root partition

Next, we need to resize the root partition. We can do this using the resize2fs tool. In this example, we will be increasing the size of the root partition to 20GB:

sudo resize2fs /dev/sda2 20G

Note that you’ll need to replace “/dev/sda2” with the name of your root partition.

  1. Create the swap file

Now that we’ve resized the root partition, it’s time to create the swap file. A swap file is a file on your file system that is used as virtual memory. To create the swap file, we will use the fallocate tool. In this example, we will be creating a 4GB swap file:

sudo fallocate -l 4G /swapfile

  1. Configure the swap file

Once the swap file has been created, we need to configure it as a swap space. To do this, we will use the mkswap tool:

sudo mkswap /swapfile

  1. Enable the swap file. Finally, we need to enable the swap file so that it can be used as virtual memory. To enable the swap file, use the following command:

sudo swapon /swapfile

  1. Update /etc/fstab

At this point, the swap file is fully configured and ready to use. However, we need to update /etc/fstab to enable the swap file on boot. To do this, add the following line to /etc/fstab:

/swapfile none swap sw 0 0

Also, make sure you remove the old swap partition line. Otherwise, the system will try to check it every time you book taking more time!

And that’s it! You’ve successfully resized your root partition and switched from a swap partition to a swap file. Your system should now boot faster since it no longer has to test the swap partition on each boot.

In conclusion, resizing partitions and switching from a swap

partition to a swap file is a simple and effective way to manage your disk space and optimize your system’s performance. With the ext4 file system, the process is straightforward and can be done without having to take your system offline. Whether you’re running out of space on your root partition or just looking to streamline your system, I hope this guide has helped you accomplish your goals.

As always, when working with system configurations and disk partitions, it’s important to proceed with caution and to backup your data before making any changes. If you follow the steps outlined in this guide, you should have no trouble successfully resizing your root partition and switching to a swap file.

So, grab your terminal and get ready to play around with partitions and swap files. Who knows, you might just discover a new love for system administration.

From Eliza to ChatGPT

When I was in college, I studied Eliza, one of the first natural language processing programs developed in the 1960s. Eliza was designed to simulate a psychotherapist and used a set of pre-defined rules and responses to generate replies to user input. At the time, Eliza was considered a significant advancement in the field of natural language processing, but it was limited in its abilities and could not provide detailed or accurate responses to complex questions.

Today, we have programs like ChatGPT, a large language model trained by OpenAI that uses the latest advancements in natural language processing to generate human-like responses to questions and prompts. ChatGPT was trained on a vast amount of text data from a variety of sources, which allows it to have a broad range of knowledge and the ability to provide detailed, accurate responses to a wide range of questions.

Here is a sample snippet of code for the Eliza program:

// Define a set of rules for generating responses
const rules = [
  {key: "i need", response: "Why do you need"},
  {key: "i want", response: "What would it mean to you if you got"},
  {key: "i feel", response: "Do you often feel"}
];

// Define a function for generating a response to user input
function generateResponse(input) {
  // Use the find() method to look for the first rule that matches the input
  const rule = rules.find(r => input.includes(r.key));

  // If a match is found, return the corresponding response
  if (rule) {
    return rule.response;
  }

  // If no rules match, return a default response
  return "I'm sorry, I don't understand what you're saying.";
}

If you want to get a full implementation of Eliza, you can visit the following link on GitHub: https://github.com/brandongmwong/elizabot-js. This repository contains the complete source code for Eliza written in JavaScript, along with detailed instructions on how to use and customize it. In addition, the repository includes a live demonstration of Eliza in action, allowing you to see how it works and how it compares to other artificial intelligence systems.

Compared to Eliza, ChatGPT is much more advanced and can provide more detailed and accurate responses to user input. While Eliza used pre-defined rules and answers to generate its replies, ChatGPT uses machine learning algorithms and a vast amount of training data to generate its responses. This allows ChatGPT to have a much broader range of knowledge and the ability to provide accurate answers to complex questions.

Overall, while Eliza was a significant advancement in its time, it is now limited compared to more advanced programs like ChatGPT. ChatGPT’s ability to generate detailed, accurate responses to a wide range of questions makes it a valuable tool in the field of natural language processing.

There are many books available that can help you understand ChatGPT and the underlying technology behind it. Some books that may be of interest include “Speech and Language Processing” by Daniel Jurafsky and James H. Martin, and “Natural Language Processing with Python” by Steven Bird These books provide in-depth information about natural language processing and how it is used in programs like ChatGPT and Eliza.

Additionally, the book “The Master Algorithm” by Pedro Domingos provides an overview of the field of machine learning and discusses how it relates to natural language processing and programs like ChatGPT. This book is a valuable resource for anyone interested in learning more about the technology behind ChatGPT and how it is used in the field of artificial intelligence.

Overall, these books provide a wealth of information about natural language processing and its applications, including ChatGPT and Eliza. They are valuable resources for anyone looking to learn more about these technologies and how they are used in the field of artificial intelligence.

There are many science fiction books that feature artificial intelligence or advanced natural language processing technology that is related to ChatGPT. Some books that you may be interested in include:

These books are all science fiction stories with advanced artificial intelligence or natural language processing technology. They may be of interest to readers who are interested in the capabilities and potential consequences of such technology.

This blog post has been 100% generated by ChatGPT.

In the future, bloggers may have to compete with tools like ChatGPT that can quickly and efficiently generate high-quality content. However, there are also opportunities for bloggers to differentiate themselves from AIs like ChatGPT. For example, bloggers who offer unique perspectives or have a distinct voice can stand out from the crowd and continue to be valuable to their audiences.

My AMD Hackintosh OpenCore triple boot in same disk notes

A few notes about the main points I learnt installing triple boot into my new PC:

  1. When picking the hardware components, search for success stories related to such components so that you make sure they’re compatible and someone has already prepared configuration you can work on instead of building the setup from zero. E.g Non APU Ryzen (without G) + Gigabyte X570 + Radeon RX580
  2. Be aware that if you want to use Hackintosh as your only OS, intel will be easier and better supported, e.g docker with hypervisor, Adobe suite… My idea is using Linux, leaving OSX option for Xcode and Windows10 for gaming and win-only software.
  3. OpenCore is currently the only option for AMD, do not lose time reading about clover. See this video as an intro, not enough to get into action but you’ll get a general idea: https://www.youtube.com/watch?v=l_QPLl81GrY
  4. You can lose data quite easily, e.g touching partitions, so make sure you backup if needed.
  5. Make sure you read this guide carefully, it’s more precise and updated than the video: https://dortania.github.io/OpenCore-Install-Guide/
  6. This guide is also quite interesting: https://github.com/alkalim/ryzen-catalina
  7. Once you’ve seen the video and read the guide you’ll be ready if you understand these topics: Boot USB, STDT, ACPI, KEXT, UEFI, config.plist, SMBIOS
  8. If you find someone who already succeeded with your same CPU + Motherboard (e.g lucky me!) it will be way more easier to setup, as you might avoid the pain of testing different kexts and configs) but you still need to make sure you understand what you’re doing (previous points). Otherwise your Mac install menu will appear in Russian and you’ll have to figure out why that happens and how to reset NVRAM.
  9. You need to installs OSs in this order: Windows, Linux, Mac (3 pendrives). Both Windows and Linux need to be running in UEFI mode, and once both are running like that, you’ll need to resize the UEFI partition to at least 200MB as it’s a Mac requirement. (EFI created by default by Windows is 100MB…)
  10. You also need a Gparted USB so that you can create the Mac partition with the free space that you left after installing Windows and Linux, you’ll use HPFS+ but in Mac install partitions tool you’ll need to enable journaling for it (File > Enable Journaling) and convert it to APFS. Otherwise it will complain about lack of “firmware partition” (UEFI) even though you had already prepared it.
  11. In the middle of the installation it will reboot without warning and restart going on the installation from the disk.
  12. If the latest Realtek kext does not work for you, e.g unable to configure NIC on installation, try with v2.2.2, it did the trick for me.
  13. Once successfully installed you typically need to do a few postinstall things:
    1. Just in case Windows update messes up with opencore boot loader make sure you install BootStrap.efi in BIOS. That way you’ll always have the “OpenCore” option in BIOS.
    2. You need to update the hard disk UEFI partition. If you prepare the USB BOOT MAC drive with gibmacos you might not have an EFI partition there, you just need to mount the EFI hard disk partition manually, delete its EFI folder and drop the one you have in the USB BOOT.
    3. If OpenCore is unable to detect Linux, make sure you installed it in UEFI mode, e.g in Linux mint picking the UEFI partition as boot partition.

Enjoy!

Other links:

https://github.com/ivmos/config/tree/master/ryzentosh

https://github.com/sergeycherepanov/homebrew-docker-virtualbox

Designing Data-Intensive Applications Book: Chapter 1 Summary

I start a series of blog posts with summaries about this interesting book: Designing Data-Intensive Applications

51gP9mXEqWL._SX379_BO1,204,203,200_.jpg

What is a data-intensive application?

It s an application where raw CPU power is rarely a limiting factor and the problems are the amount of data, the complexity of data, and the speed at which it changes. It is built from standard building blocks that provide commonly needed functionality.

In this chapter, we see the fundamentals of what we are trying to achieve.

Continue reading Designing Data-Intensive Applications Book: Chapter 1 Summary

Google Photos API, how to use it and why it will probably disappoint you

photos_96dp

 

Recently I needed to close a Google Apps account, and I tried to migrate albums programmatically.  I’ll document here the needed steps and explain why this Google API is useless for most of us:

First you need an app token, you can get it from Google Console on https://console.developers.google.com. There you need to register your project and associate API from the library.

You should now have both client_id and client_secret so you can fetch the code quite easily with a OAUTH2 flow:

#!/bin/sh

$client_id = "foo"
$client_secret= "bar"

scope="https://www.googleapis.com/auth/photoslibrary+https://www.googleapis.com/auth/photoslibrary.sharing"

url="https://accounts.google.com/o/oauth2/auth?client_id=$client_id&redirect_uri=urn:ietf:wg:oauth:2.0:oob&scope=$scope&response_type=code"

echo $url

If you open such output URL with a browser you’ll get the $code and with such code, you can just fetch the tokens.

$code = "lol"
curl --request POST --data "code=$code&client_id=$client_id&client_secret=$client_secret&redirect_uri=urn:ietf:wg:oauth:2.0:oob&grant_type=authorization_code" https://accounts.google.com/o/oauth2/token

With the refresh_code you can already do what you need, here you have an example kotlin script I worked on https://gist.github.com/ivmos/860b5db0ffeeeba8ffd33adebfaaa094

But finally, I just did it manually zooming out from web client. It happens that Google just offers consents that allow you to manipulate photos and albums created with your own app, so you can’t move around photos between albums created by the official too. This means you cannot organize your library automatically unless you just need to work with photos you would upload with your own app…

 

 

My 2019 Coursera courses

2019 was an awesome year for me, mainly because I became father 🤗 but I also found time to keep my learning habit 🤓, something very important after 15 years since my first job in the field. So I’d like to list and elaborate on the Coursera courses I did and why:

  • Conflict Resolution Skills (cert): a good introduction, something essential even if you’re in an individual contributor position but critical in management.
  • Kotlin for Java developers (cert): a great course in order to jump from Java to Kotlin. We’ve been increasingly using Kotlin at work (even for microservices!) so I found it was a good way to review the language in general.
  • Programming Languages, Part A (cert): getting into functional programming was something I wanted to do for a long time, I did some Haskell at uni but that was ages ago and I knew typical few things used in JavaScript or Kotlin but using a pure FP language is a very different thing.
  • Programming Languages, Part B (cert): Part A used SML, this other part used Racket which was a bit parenthesis nightmare at first but it turned to be very fun as I practiced implementing a little programming language something I hadn’t done since university,

If you have a recommendation of any online course for 2020 please leave a comment 🙂

HOWTO see Google Calendar events in yearly view

245px-google_calendar

It turns out I already have booked a few events for 2019 so I wanted to have a yearly view of everything I have. I was disappointed to see that current Google Calendar yearly events view is useless as It’s just empty. There are lots of comments about this issue in this Google productforums entry.

Captura de pantalla 2019-01-12 a las 13.07.50.png
:S

Captura de pantalla 2019-01-12 a las 13.15.33.png
Ron Irrelavent is absolutely right

So I did some search to look for solutions and I found these 2:

  • Google Calendar Plus extension
    • I haven’t even tried as I’m tired of Chrome extensions but seems to work.
  • Visual-Planner project
    • A bit ugly but it works and it’s open-source so this is what I’m using. You can use it without installing it here (you just need to OAUTH to your gmail account). Only drawback is that it does not display names for multi-day events, as a workaround you can create a single event for the first day e.g “Flight to London”

Captura de pantalla 2019-01-12 a las 13.13.09.png
This is something ¯\_(ツ)_/¯

Let me know if you have better alternatives.

I also hope Google implements this..  Hello Google PMs? 🙂

Thoughts about React Native after working with it

react-native-800x450.png

I faced the following challenge in January:

  • Porting a complex webapp to native Android and iOS. The web-app to be ported is written in ReactJs+Redux. Besides most of its business logic is in a pure ES5 javascript library.

So in this situation, React Native (“RN” from now on) seemed like the way to go as we wanted to have a working prototype in a month and it should be maintained in both Android and iOS without extra resources.

Continue reading Thoughts about React Native after working with it

A Tech Lead HOWTO

I’ve been working in a Tech Lead role position for something more than 2.5 years. Some notes I can write here that would have been useful for me and hopefully for someone reaching this page:

  1. Read this HN question comments: https://news.ycombinator.com/item?id=10395046
  2. Create a roadmap, parallel to the team projects. Make sure you have a long-term plan in mind.Having-a-Social-Media-Game-Plan-Higher-Profits.jpg
  3. Your team needs to fulfill the projects maintaining a good working environment, otherwise, they’ll burn out soon. The opposite is true too, it does matter having the happiest team if projects don’t evolve as they should.Happy_minions.jpg
  4. Be patient, start just with little improvements as you understand your area. Avoid revolution feeling, people don’t like too many changes at the same time.
  5. Coding is probably not the most important thing you’ll do for your team. First months it will feel awkward but you’ll get used to it once you understand your responsibilities.
  6. Understand your area top-down, from architecture to code so you’ll probably won’t be an expert in every repo but you probably should be an expert of how everything glues together, how the architecture works and how it should evolve.
  7. 1:1s are one of the most important things you’ll do, make sure most of the 1:1 time is just informal, the projects sync part should be just the first 5 minutes. Try fixing calendar events for them.1-1s.png
  8. Overcommunicate: tell important things to the team as a group and repeat it again in each 1:1 and see if your message is being understood. Always ask for the opinion, especially in 1:1s, your mates will often help you to do things better.
  9. Be data driven, make sure you can see the state of everything with data, you should not need to do ad-hoc queries or launching dirty scripts to gather important health data. Your important telemetrics and KPIs should always be available to be reviewed. However, if you find yourself checking a metric a lot for certain thresholds, just create an alarm!Data-driven-business.jpg
  10. You’ll need to keep caring about your craftsmanship and it will be more difficult than ever as you won’t be coding most of the day. However, you should make sure you keep improving technically, not just growing in soft skills. Try maintaining pet-projects, courses and try to contribute to team code in small priority tasks from time to time.
  11. Be involved in code reviews and read every pull request if possible, that’s where you’ll feel how good work is evolving. However, avoid micro-manage, especially to senior mates, just be a helpful safety net if needed. Avoid commenting in CRs if you have nothing important to say, avoid the “here comes the boss comment” syndrome.03
  12. Detect any block and tackle it with most urgency. It’s one of your main responsibilities. Ask for blocks in every standup.
  13. Be the tech proxy for your team so that they can focus on their tasks. Be ready to be interrupted, learn how to optimize context changes. Actually, make sure your team understands you’re approachable and they can ping you if any problem without waiting, you’re there to be interrupted at any time if needed.
  14. Supervise estimations. Avoid being always dummy conservative, think carefully about risks and if any high risk then yes, be conservative with estimation. But if you’re estimating a task your team already did in the past, it should be pretty straightforward (and perhaps should be automated?)
  15. Try introducing and welcome changes to how things are done but be careful about when those changes are applied as if they impact a project, it can be difficult to justify. Related to this, avoid taking the easy route of just saying always “NO” to new things just to avoid risks, as your platform should evolve as part of your plan.main-qimg-fbef4b8b75dbb14bf216652c98ef2232
  16. Measure technical debt, buy it consciously and fight it as part of your plan with priorities.
  17. Improve your soft skills. You’ll be more time talking to people than to your IDE.
  18. Be always constructive with feedback, as a criticism without action points to follow is not a solution.
  19. Be the Toxic-comments goalkeeper. Try favoring a positive environment. However, don’t confuse toxic comment with a constructive critic.24293_1.jpg
  20. Tech Lead position is quite prone to workaholism. Go home! Read this post by Rafael López: https://badoo.com/techblog/blog/2017/04/11/leads-go-home-and-take-your-reports-with-you/

 

Good luck!