Weekly Issue 12: The Weekly Wheel Plan, How Programmers Should Blog

Original link: https://4ark.me/post/weekly-12.html

wheel of the week

I have read a booklet “Learn a npm wheel a day, become a wheel brother in ten days” , I feel that this kind of “first implement the lowest solution, then slowly optimize, and then derive the final source code” The learning idea is very Good, so I also decided to learn to build an npm wheel every week from now on.

Of course, in the early stage, you only need to focus on those relatively simple npm packages for daily use.

Here’s this week’s wheel: Weekly Wheels only-allow: Unified Specification Team Package Manager .

This week’s news

How should programmers blog?

This is a post I saw on V2EX. The OP is a nonsense blogger mentioned by the weekly magazine before. In this post, I got a lot of useful suggestions, and I also accidentally found a few good blogs. I would also like to take this opportunity to share some thoughts on this topic as a summary and reflection on my personal writing.

Looking back at the first article on this site, “Ruijie Wireless AP Study Notes – Getting Started” , it was written in 2018 and is now in its 4th year. Compared with some people who have been building sites for more than ten years, they are naturally young, but I think I have struggled and persevered a lot in blogging. To sum up, I have gone through the following stages, but in fact the following stages are not progressive, they may happen at the same time:

  1. Recording study notes . The output at this stage is mainly some relatively basic study notes, and the originality is also low. It belongs to a large number of online searches. The help to others is close to nothing. I remember sharing an article at that time. In the technical community, I was told by some irritable old brothers that I had mistaken someone for my son, and even more directly asked me to copy the entire book. I once doubted whether I should continue to “take out the trash” in the Chinese community, but in the end I persevered. As far as I know, many programmers just start blogging by writing such study notes, and many people just stay at this stage or even give up, which is a pity.
  2. In the resource sharing category , it is difficult to write technical articles, and it is even more difficult to add in-depth technical articles, so there was a time when I especially liked to write articles in the “resource sharing” category, such as “Share some useful websites” , “Share some useful Chrome extensions” , this kind of article doesn’t take much time and experience to write. You only need to share the websites and tools you often use, and you can gain a lot from the community. Likes and favorites, this is why there are so many Markdown projects in Simplified Chinese projects on GitHub, but I later realized that writing such articles does not help me much in improving my personal ability, if you know some very useful tools , you really should share it with more people, it’s very valuable, but my advice is to never settle for just writing these kinds of articles.
  3. More in-depth technical articles , with the increase of working time, I have some accumulation in technology, I began to try to write some more in-depth technical articles, including some classic interview questions explanation, source code reading, in-depth knowledge point It is the most painful to write such articles, because you will find that you can’t explain it clearly somewhere in the process of writing, indicating that you do not understand it thoroughly, so you only Being able to force yourself to consult the document while explaining it in your own words according to your own understanding is naturally very rewarding in the process, and the help to others is not small.
  4. It has nothing to do with technology . Humans are animals with emotions. Apart from technology, we always need to talk about other things. It may be some insights in life, or it may be your opinion on a certain thing. This kind of article, it It may not only resonate with readers, but also may be disgusted because of different opinions from readers, and many times, I am not sure whether these opinions are correct, so I am afraid of being seen by others as immature. On the one hand, I also had concerns in this regard, and did not dare to openly talk about too many things unrelated to technology on the blog, but later I found out that I was overly concerned, because often the final readers of such articles are only you, because When a reader reads your article, he will only care about the things that are helpful to him, and even if you may be immature in your records at the time, this is also the mark of your growth. For example, I often read when I am confused. From the “Why I Become a Programmer” that I wrote when I first entered the workplace, tell myself not to forget why I embarked on the road of technology, so don’t be afraid to write about things other than technology, these immature words are very Might keep motivating you for years to come.

There may be some students who think that their writing is not good, their vocabulary is poor, and they cannot write so many words. In fact, they are overthinking. I confess that my writing is actually very poor. Be clear and inject your feelings. In short, write more and keep writing.

some tips

QOTD protocol

The whole process of QOTD is Quote of the Day , which is translated as “quote of the day”. It is defined in RFC 865 and the listening port is 17. This is a very rarely used protocol. There are only a few public QOTD servers left. :

server address TCP port UDP port
djxmmx.net 17 17
alpha.mike-r.com 17 17
cygnus-x.net 17 17

What can be done with it?

For example, there is a famous quote on djxmmx.net server that uses this protocol on GitHub Action to regularly obtain and update it to Github Profile.

share article

Bash Pitfalls: programming mistakes

This article is the Chinese translation version of “Bash Pitfalls” , which introduces more than 40 wrong programming habits in daily Bash programming, which are easy to be ignored by both veterans and novices. The author will analyze and explain the reasons for the errors in detail on each example that gives errors, and give correct rewriting suggestions.

Some tips for building Docker images

This article shares some tips for building Docker images, which can help you improve the efficiency of building Docker images. It is already a very basic thing for veterans, but it is still very helpful for newbies.

A total of 4 techniques are listed in the original text. Here I only explain the first technique in detail, and the rest of the troubles can be viewed in the original text .

  1. delete cache

When using package managers such as apt and pip to download packages, caches are generally generated for subsequent downloads, but in Docker Image, we do not need these caches, so we generally clear the cache manually after downloading:

 1
2
3
4
 RUN dnf install -y --setopt=tsflags=nodocs \
httpd vim && \
systemctl enable httpd && \
dnf clean all

Remember not to write separately like this, because each RUN in the Dockerfile will create a new layer, which actually creates 3 layers, the first 2 layers bring the cache, and the third layer deletes the cache:

 1
2
3
4
 FROM fedora
RUN dnf install -y mariadb
RUN dnf install -y wordpress
RUN dnf clean all

But in fact, Docker introduced the –squash parameter in v1.13 , which can compress all layers into one layer after completing the build, that is to say, the Docker image finally built has only one layer, so, as above, in multiple RUN It is also possible to write the clean command.

 1
 docker build --squash
  1. Move the content that changes infrequently forward
  2. Build and Run Image Separation
  3. Check build artifacts

JavaScript functional composition: what’s the big deal?

This is the most accessible article I have seen in writing JavaScript functional composition. The author implements compose, pipe, flow and other methods step by step from the beginning, and let students who do not know much about functional composition know that, What are the benefits of functional composition?

For example, if we use Array’s method like this:

 1
2
3
4
5
6
 const comments = commentStrs
.filter(noNazi)
.slice( 0 , 10 )
.map(emphasize)
.map(itemize)
.join( '\n' );

The way to use functional composition instead is like this:

 1
2
3
4
5
6
7
 const comments = pipe(commentStrs,
filter(noNazi),
take( 10 ),
map(emphasize),
map(itemize),
join( '\n' ),
);

What is the advantage of writing this way?

First, we can add any custom method that isn’t on the Array prototype:

 1
2
3
4
5
6
7
8
 const comments = pipe(commentStrs,
filter(noNazi),
take(10),
map(emphasize),
map(itemize),
join('\n'),
+ chaoticListify,
);

Additionally, we are free to implement methods like map , for example using generators, without changing the way they are called:

 1
2
3
4
5
 const map = f => function *( iterable ) {
for ( let x of iterable) yield f(x);
};

const join = s => iterable => [...iterable].join(s);

To sum up, writing code using functional composition allows us to write more concise and elegant code, and more importantly, it provides us with another way of thinking.

Chinese hacker relationship diagram

This article is a warm-up article for the new book “Boiled Xin’an Zhi”. It mainly tells the stories of legendary hackers in China from the end of the last century to the beginning of this century. Students who want to know what famous hackers are and where they are now can read it. Look.

The cybersecurity industry is very similar to the martial arts arena. There are sects, martial arts, martial arts conferences, tactics and treasures, and there are few heroes and many thieves. Even the control methods of the imperial court are very similar. .

In this atmosphere, such a group of strange people appeared.

In the most difficult years, as long as they lowered their moral bottom line a little, they could live and breathe without worry, but they did not;

They have the most superb technology, but they hold half or even lower salaries in the traffic industry. As long as they do a little bit of gray production, they can get out of the predicament, but they don’t;

They have endured the doubts of the society and the negativity brought by the hooligans of the industry, but they still insist on the technological innovation they love.

Until now, they finally waited for their own time.

interesting link

  • Similarweb : View and analyze any website traffic, a must-have tool for webmasters
  • Codeit : an artifact APP that connects your phone to Git to view code
  • Queue : A tool for tweeting with Notion
  • Coverview : A tool for generating article title maps

This article is reprinted from: https://4ark.me/post/weekly-12.html
This site is for inclusion only, and the copyright belongs to the original author.

Leave a Comment