Skip to content

Home

Installing Ubuntu 19.10 on a MacBook Pro 13,1

Welcome to Continuous Improvement, the podcast where we explore ways to make our lives better, one step at a time. I'm your host, Victor, and today we're going to talk about a topic that might interest our fellow software developers out there. Have you ever found yourself frustrated with a particular operating system? Well, I certainly have, and today I want to share with you my journey from macOS to Ubuntu on my MacBook Pro.

As a software developer, having the right tools and environment to work in is essential. But sometimes, the operating system you're using can prove to be a roadblock to your productivity. That's when I decided to explore an alternative, and after some research, I found that Ubuntu could be the answer.

One of the reasons I wanted to switch from macOS Catalina to Ubuntu was the amount of disk space that Xcode and its bundled tools were taking up. Up to 10GB of disk space just for one software package! As a developer, I couldn't afford to waste precious time waiting for slow downloads and updates to finish.

Now, the first concern that popped into my mind was whether my MacBook Pro hardware would be compatible with an open-source Linux distribution like Ubuntu. But to my surprise, thanks to the efforts of the community, many features worked right out of the box with a fresh Ubuntu install. The screen, keyboard, touchpad, and Wi-Fi all worked seamlessly. The only feature that required a workaround was audio, which I managed to solve by using USB Type-C headphones or connecting to an external monitor with built-in speakers.

If you're curious about trying Ubuntu on your MacBook Pro, the process is actually quite simple. First, you'll need to download Ubuntu 19.10 from the official Ubuntu website. Once you have the ISO file, you'll create a bootable USB stick using a tool called Etcher. There's a helpful guide available on the Ubuntu website that will walk you through this step-by-step. After that, restart your MacBook, press the Option key, and select the USB stick as the boot device. From there, you can try Ubuntu and proceed with the installation if it suits your needs.

As a developer, I found that setting up essential tools like Git on Ubuntu was a breeze. With a simple command, you can install Git and start using it right away. This is a much more straightforward process compared to macOS, which can restrict your freedom in various ways.

It's important not to become too comfortable with a single platform. By exploring alternative operating systems like Ubuntu, you can embrace the open-source community and experience the freedom of choice. At times, big corporations may not always act in our best interest when it comes to protecting our personal data from government surveillance. That's where open-source software shines, giving us the opportunity to take control of our own digital lives.

Before we wrap up, I want to share a couple of additional resources if you decide to make the switch to Ubuntu on your MacBook Pro. If you want to get Bluetooth working, there's a handy script available on GitHub that you can use. And if you're also looking to get your camera working, there's a detailed guide available to help you install the necessary driver.

Well, that's all for today's episode of Continuous Improvement. I hope that this discussion on transitioning from macOS to Ubuntu has given you some valuable insights. Remember, don't be afraid to explore alternatives and continuously improve your work environment. Stay tuned for our next episode, where we'll tackle another exciting topic. Until then, keep striving for continuous improvement in all aspects of your life.

在 MacBook Pro 13,1 上安裝 Ubuntu 19.10

我對 macOS Catalina 感到挫折,因此決定將 Ubuntu 設為我 13 英寸的 MacBook Pro(不帶觸控條)的主要操作系統。作為一名軟件開發者,我發現 macOS 會與 Xcode 一同打包許多工具,這將佔用多達10GB的磁碟空間。雖然磁碟空間並非我主要的憂慮,但有時候網路下載的速度會很慢,而更新也可能會卡住。在試圖完成工作時流失一小時是不必要的障礙。

我起初擔心專有硬體是否能與開源的 Linux 分佈版兼容。令我驚訝的是,許多功能在初次安裝後就可以立即使用,感謝社區的努力。這包括了螢幕、鍵盤、觸控板,以及 Wi-Fi。唯一不適用的功能是音訊,但我可以使用我的 USB Type-C 耳機或帶有喇叭的 HDMI 外接顯示器來解決這個問題。這個 GitHub 頁面提供了關於各種 MacBook 硬體與 Linux 兼容性的詳細文檔:MacBook 在 Linux 上的硬體支援

如果你對在 MacBook Pro 上試用 Ubuntu 感興趣,請按照以下幾個簡單的步驟操作:

  1. Ubuntu 官方網站 下載 Ubuntu 19.10。
  2. 按照此指南的步驟,使用 Etcher 製作可開機的 USB 隨身碟:在 macOS 上製作 USB 隨身碟
  3. 重新啟動你的 MacBook,並按下 Option 鍵,選擇 USB 隨身碟作為開機設備。
  4. 嘗試使用 Ubuntu,如果你覺得合適,就繼續進行安裝。

就是這樣!作為開發者,你可以透過執行 sudo apt install git 來快速設定這類必要工具。這比在 macOS 上更簡單,macOS會以各種方式來限制你的自由。不應該對任何一個平台過於依賴,因為不能一直相信大公司會為了你的最佳利益行事,例如保護你的個人資料不受政府監視。擁抱開源社區,欣賞選擇替代操作系統的自由。

附註 1: 若要讓藍牙運作,請在這個儲存庫中執行找到的腳本:

MacBook 藍牙驅動

附註 2: 若要讓相機運作,請按照這份指南來安裝驅動:

相機驅動指南

Setting Up MongoDB with Koa.js

I'm building a Koa.js server and need to connect it to MongoDB to store and retrieve data. Here's how to accomplish this in a few simple steps:

Step 1: Connect to the Database Before Initializing the Koa App

const initDB = require("./database")

initDB()

const app = new Koa()

Inside database.js, import mongoose. Make sure to install mongoose using npm install --save mongoose as well. Mongoose is an Object Data Modeling (ODM) library.

const mongoose = require("mongoose")
import { connectionString } from "./conf/app-config"

const initDB = () => {
  mongoose.connect(connectionString)

  mongoose.connection.once("open", () => {
    console.log("Connected to the database")
  })

  mongoose.connection.on("error", console.error)
}

module.exports = initDB

Next, create the configuration for your connection string:

export const connectionString =
  "mongodb+srv://" +
  secret.mongodb.username +
  ":" +
  secret.mongodb.password +
  "@xxxxxx.mongodb.net/test?retryWrites=true&w=majority"

You can either run a local MongoDB instance or use MongoDB Atlas and host it on AWS cloud. You'll find the connection string to include in your config file there.

Step 2: Create a Schema in Koa

For instance, let's create a user schema inside /models/users.js.

const mongoose = require("mongoose")
const Schema = mongoose.Schema

const UserSchema = new Schema({
  username: String,
  email: String,
  picture: String,
})

module.exports = mongoose.model("User", UserSchema)

Step 3: Create a Service to Query the Data

Let's say we have a /service/user.service.js.

import User from "../models/users"

export const getUserFromDb = async username => {
  const data = await User.findOne({ username })
  return data
}

export const createUserInDb = async user => {
  const newUser = new User(user)
  await newUser.save()
  return user
}

Step 4: Call the Service in the Koa Controller

For instance, let's say we have a /controller/user.controller.js.

    import { getUserFromDb, createUserInDb } from '../service/user.service';

    static async getUser(ctx) {
      const user = await getUserFromDb(ctx.query.username);
      ctx.body = user;
    }

    static async registerUser(ctx) {
      const user = await createUserInDb(ctx.request.body);
      ctx.body = user;
    }

Finally, you can register the route using the controller. Now you should be able to see the data being stored in the database. Feel free to reach out if you have any questions.

Setting Up MongoDB with Koa.js

Welcome back to another episode of Continuous Improvement, the podcast where we explore the world of software development and find ways to level up our coding skills. I'm your host, Victor. In today's episode, we're going to dive into connecting a Koa.js server to a MongoDB database. If you're ready to learn, let's get started!

Before we begin, make sure you have Koa.js and MongoDB installed. Once that's done, let's jump right into the steps.

Step one, connect to the database before initializing the Koa app. To do this, you'll need to create a database.js file. Inside that file, import Mongoose, an Object Data Modeling (ODM) library, and your connection string from the configuration file. Remember to install Mongoose by running npm install --save mongoose.

const mongoose = require('mongoose');
import { connectionString } from './conf/app-config';

const initDB = () => {
  mongoose.connect(connectionString);

  mongoose.connection.once('open', () => {
    console.log('Connected to the database');
  });

  mongoose.connection.on('error', console.error);
};

module.exports = initDB;

Step two, create a schema in Koa. For example, let's create a user schema inside the /models/users.js file.

const mongoose = require('mongoose');
const Schema = mongoose.Schema;

const UserSchema = new Schema({
  username: String,
  email: String,
  picture: String
});

module.exports = mongoose.model('User', UserSchema);

Step three, create a service to query the data. In this example, we'll create a /service/user.service.js file.

import User from '../models/users';

export const getUserFromDb = async (username) => {
  const data = await User.findOne({ username });
  return data;
};

export const createUserInDb = async (user) => {
  const newUser = new User(user);
  await newUser.save();
  return user;
};

And finally, step four, call the service in the Koa controller. For instance, let's say we have a /controller/user.controller.js file.

import { getUserFromDb, createUserInDb } from '../service/user.service';

static async getUser(ctx) {
  const user = await getUserFromDb(ctx.query.username);
  ctx.body = user;
}

static async registerUser(ctx) {
  const user = await createUserInDb(ctx.request.body);
  ctx.body = user;
}

And there you have it! By following these steps, you should be able to connect your Koa.js server to a MongoDB database. If you have any questions or need further assistance, feel free to reach out.

That's it for today's episode of Continuous Improvement. I hope you found this information helpful in your journey as a developer. Don't forget to subscribe to our podcast for more valuable insights and tips. Until next time, happy coding!

設置 MongoDB 與 Koa.js

我正在建設一個 Koa.js 服務器,並需要將其連接到 MongoDB 以儲存和檢索數據。以下是如何在幾個簡單的步驟中實現這一點:

步驟1:初始化 Koa 應用程序之前連接到數據庫

const initDB = require("./database")

initDB()

const app = new Koa()

database.js 中,導入 mongoose。同時確保使用 npm install --save mongoose 進行安裝。Mongoose 是一個物件數據建模(ODM)庫。

const mongoose = require("mongoose")
import { connectionString } from "./conf/app-config"

const initDB = () => {
  mongoose.connect(connectionString)

  mongoose.connection.once("open", () => {
    console.log("Connected to the database")
  })

  mongoose.connection.on("error", console.error)
}

module.exports = initDB

接下來,為您的連接字符串創建配置:

export const connectionString =
  "mongodb+srv://" +
  secret.mongodb.username +
  ":" +
  secret.mongodb.password +
  "@xxxxxx.mongodb.net/test?retryWrites=true&w=majority"

您可以運行本地 MongoDB 實例,或者使用 MongoDB Atlas 並將其託管在 AWS 雲上。您會在那裡找到包含在配置文件中的連接字符串。

步驟2:在 Koa 中創建一個 Schema

例如,讓我們在 /models/users.js 中創建一個用戶模式。

const mongoose = require("mongoose")
const Schema = mongoose.Schema

const UserSchema = new Schema({
  username: String,
  email: String,
  picture: String,
})

module.exports = mongoose.model("User", UserSchema)

步驟3:創建一個服務來查詢數據

假設我們有一個 /service/user.service.js

import User from "../models/users"

export const getUserFromDb = async username => {
  const data = await User.findOne({ username })
  return data
}

export const createUserInDb = async user => {
  const newUser = new User(user)
  await newUser.save()
  return user
}

步驟4:在 Koa 控制器中調用服務

例如,假設我們有一個 /controller/user.controller.js

    import { getUserFromDb, createUserInDb } from '../service/user.service';

    static async getUser(ctx) {
      const user = await getUserFromDb(ctx.query.username);
      ctx.body = user;
    }

    static async registerUser(ctx) {
      const user = await createUserInDb(ctx.request.body);
      ctx.body = user;
    }

最後,您可以使用控制器註冊路由。現在,您應該能夠看到數據被存儲在數據庫中。如果您有任何問題,請隨時聯繫我。

Migrating Your Blog from Medium to Ghost 3.0

Ghost 3.0 has just been released (https://ghost.org/3/). I have a strong preference for Ghost over WordPress because it uses Node.js instead of PHP. Not only is Ghost open-source, but it also offers a pretty cool dark theme. So, I decided to migrate my blog away from Medium. However, the process isn't straightforward and does come with some associated costs. Here are the steps to help you navigate the migration and regain control of your content:

Step 1: Export Posts from Medium

Navigate to Settings on Medium and find the section that allows you to download your data:

Step 2: Import to WordPress.com and Export the File

Create a free account on WordPress.com. In the Import section, you'll find an option to import content from Medium:

After successfully importing your content from Medium, you can then export the file from WordPress.com:

Step 3: Import the File to WordPress.org via Plugin and Export the File

Download the open-source WordPress software from http://wordpress.org/ and run it locally using MAMP (https://www.mamp.info/en/). Copy all the WordPress files and place them in the /htdocs folder within MAMP. Start the server, and you should be able to run the local WordPress instance with MySQL installed.

Navigate to the Import section and select the option to import from WordPress:

Next, install the official Ghost plugin from https://wordpress.org/plugins/ghost/ and export your blog posts using this plugin:

Although there's an option to download the Ghost file, it didn't work for me. Try clicking on the download .json file instead.

Step 4: Import to Ghost Blog

Go to Settings and then the Labs section in Ghost, and import your file:

Fingers crossed! If all goes well, you should see all your posts from Medium now migrated to Ghost 3.0. Happy blogging :)

Migrating Your Blog from Medium to Ghost 3.0

Welcome back to "Continuous Improvement," the podcast where we explore ways to enhance our personal and professional lives. I'm your host, Victor, and in today's episode, we're diving into the exciting world of blogging platform migration. Specifically, we'll discuss how to migrate your blog from Medium to Ghost 3.0.

But before we begin, let me share why I prefer Ghost over WordPress. Ghost, unlike WordPress, is built using Node.js instead of PHP. It's not only open-source, but it also offers a sleek and stylish dark theme. So, if you're ready to regain control of your content and make the jump to Ghost, let's get started.

Step one: Exporting your posts from Medium. Head over to the Settings section on Medium's platform and locate the section that enables you to download your data. Click on it, and your post data will be exported to a file.

Moving on to step two: Importing the exported file to WordPress.com. Create a free account on WordPress.com, and within the Import section, you'll find an option to import content from Medium. Follow the prompts to successfully import your posts. Once completed, you can then export the file from WordPress.com in a format compatible with Ghost.

Step three: Importing the file to WordPress.org via a plugin. Begin by downloading the open-source WordPress software from wordpress.org. Run it locally using MAMP, a tool that allows us to set up a local server environment. Once set up, copy all the WordPress files and place them in the htdocs folder within MAMP. Start the server, and voila! You should now be able to run your WordPress instance on your local machine.

Within the WordPress dashboard, navigate to the Import section and select the option to import from WordPress. Follow the instructions to import the file you previously exported from WordPress.com.

Now, it's time to prepare for the final export. Install the official Ghost plugin from the WordPress plugin repository. With the plugin installed, you can export your blog posts using it. Though you're provided with an option to download the Ghost file, it may not work as expected. Instead, try clicking on the download .json file option as an alternative.

Step four: Importing your posts to Ghost. In your Ghost dashboard, go to the Settings tab and then navigate to the Labs section. Here, you'll find an option to import files. Select your exported file and initiate the import process. With a little luck, all your posts from Medium should now be beautifully migrated to Ghost 3.0.

And that's it! Congratulations on successfully migrating your blog from Medium to Ghost 3.0. Feel free to explore Ghost's various features and continue your blogging journey with this powerful open-source platform.

Thank you for tuning in to this episode of "Continuous Improvement." I hope you found the information valuable and that it encourages you to embrace new platforms like Ghost. Remember, continuous improvement is all about taking small steps towards a better future, both in your personal and professional endeavors. If you have any questions or suggestions for future episodes, please reach out to me through our website. Until next time, keep improving!

將您的部落格從Medium遷移到Ghost 3.0

Ghost 3.0剛剛被發佈 (https://ghost.org/3/)。我對Ghost比WordPress有強烈的偏好,因為它使用Node.js而不是PHP。Ghost不僅是開源的,還提供了非常酷的黑色主題。所以,我決定將我的部落格從Medium遷移出去。然而,該過程並不直接,也有一些相關的成本。下面是一些步驟幫助你導航遷移並重新控制你的內容:

步驟一:從Medium導出帖子

在Medium上導航到設置並找到允許您下載您的數據的部分:

步驟二:導入至WordPress.com並導出文件

在WordPress.com上創建一個免費帳戶。在導入部分,您會找到一個可以從Medium導入內容的選項:

成功從Medium導入內容後,你可以從WordPress.com導出文件:

步驟三:通過插件將文件導入至WordPress.org並導出文件

http://wordpress.org/ 下載開源的WordPress軟件並使用MAMP (https://www.mamp.info/en/) 在本地運行。複製所有的WordPress文件並將它們放在MAMP內的/ htdocs資料夾中。啟動服務器,您應該能夠運行安裝了MySQL的本地WordPress實例。

導航至導入部分,並選擇從WordPress導入的選項:

然後,從https://wordpress.org/plugins/ghost/ 安裝官方的Ghost插件,並使用此插件導出你的部落格文章:

雖然有一個下載Ghost文件的選項,但對我來說並未奏效。嘗試點選下載.json檔案。

步驟四:導入至Ghost博客

轉到設置,然後轉到Ghost中的實驗室部分,並導入您的文件:

交叉手指!如果一切順利,您應該能看到所有您從Medium導出的文章現已遷移到Ghost 3.0。祝你寫博愉快 :)

Setting Up npm Proxy in a Corporate Network

Working behind a corporate network can be challenging, as many things do not work "out of the box." A simple command like npm install might not function properly. Here's how to work through the proxy:

Assuming you've somehow managed to install node.js on your corporate laptop, locate the .npmrc file. On Windows, this is typically located at C:\Users\<your_user_id>\.npmrc, and on a Mac, it's at Users/<your_user_id>/.npmrc.

Open the file and add the following lines:

    https-proxy=http://yourcompanyproxy.com:80
    proxy=http://yourcompanyproxy.com:80
    strict-ssl=false
    registry=http://registry.npmjs.org/

Try running npm install again; it should work now!

Here's an additional tip: if you have some dependencies hosted in your corporate internal Nexus npm repository—let's say in the @npmcorp scope—run the following command to specify the correct registry URL:

    npm config set @npmcorp:registry https://your-company-nexus:80/nexus/content/repository/npm-internal

By doing this, you should be able to resolve any "dependency not found" errors. Give it a try!

Setting Up npm Proxy in a Corporate Network

Hello and welcome to "Continuous Improvement," the podcast where we explore strategies and techniques to enhance our professional lives. I'm your host, Victor, and today we'll be diving into the topic of working behind a corporate network and overcoming challenges that arise. Specifically, we'll be discussing how to successfully work with proxies when using commands like npm install.

Working within a corporate network often requires additional steps to get things up and running smoothly. For instance, commands that typically work perfectly outside the corporate environment may not function as expected within it. But fear not, because today we'll be sharing some helpful tips to work through proxy issues and ensure you can use npm install without any hiccups.

Assuming that you've already installed node.js on your corporate laptop, the first step is to locate the .npmrc file. On Windows, this file is typically found at C:\Users\<your_user_id>\.npmrc. And on a Mac, you can find it at Users/<your_user_id>/.npmrc.

Open the .npmrc file and add the following lines:

    https-proxy=http://yourcompanyproxy.com:80
    proxy=http://yourcompanyproxy.com:80
    strict-ssl=false
    registry=http://registry.npmjs.org/

These lines will help in configuring the proxy settings necessary to ensure the smooth functioning of npm install. Now, give npm install another try, and you'll see that it works seamlessly!

But wait, there's more! If you have dependencies hosted in your corporate internal Nexus npm repository, there's an additional step you can take to resolve any "dependency not found" errors. Let's say your dependencies are in the @npmcorp scope. To specify the correct registry URL, run the following command:

    npm config set @npmcorp:registry https://your-company-nexus:80/nexus/content/repository/npm-internal

By running this command, you'll ensure that the correct registry URL is used, and any "dependency not found" errors will be resolved. It's a small step that can make a big difference in your work.

So there you have it, a couple of essential tips to overcome proxy issues when working with npm install within a corporate network. By configuring the proxy settings and specifying the correct registry URL for internal dependencies, you'll be able to navigate any obstacles that come your way.

That wraps up today's episode of "Continuous Improvement." I hope you found these tips helpful and will apply them in your work environment. Remember, it's all about continuously improving our professional lives, one step at a time.

If you have any questions or specific topics you'd like us to cover, feel free to reach out to us on our website or social media channels. Don't forget to subscribe to our podcast for more insightful episodes.

Thank you for joining me today. I'm Victor, and until next time, keep striving for continuous improvement.