Sekai ๐ŸŒ ๐Ÿ—บ

Sekai (ไธ–็•Œ) is the kanji for “the world”. That’s a great word because of the scale that it designates.

Detect Missing EOF

While editing files on GitHub/Gitlab, missing an empty line at the bottom of a file in the buffer will result in no newline at the end of file. In the case of regular text files, this isn’t consistent with the POSIX standards.

for file in `git ls-files`; do
  grep -Iq . $file && if ! newline_at_eof $file; then; else echo $file; fi
done

Fred has provided a shell script for detecting EOF on Stack Overflow. I’ve replaced bash with sh because I’m using Zsh.

[Read More]
Linux 

Find Files for Rename

Background

Three years ago, I wrote Used More Bash Utilities for batch renaming files. One of my Facebook friends has pointed out that it fails for file names containing whitespace.

Problem

Recently, I would like to remove the extension name .sh of all shell scripts in ~/bin, so that which {script} will work without .sh.

Method

A for loop over $(ls) is a basic solution, but find is more correct since it’s possible that a file name contains a space character.

[Read More]
Linux 

Comparaison of Two Docker Images for Hugo

Having importing the repo for the Hugo theme Introduction from GitHub to GitLab, I added the automatically generated GitLab CI config file and I ran job #135854407.

$ cd exampleSite
$ hugo --themesDir=../.. -d ../public
hugo: /usr/lib/libstdc++.so.6: no version information available (required by hugo)
hugo: /usr/lib/libstdc++.so.6: no version information available (required by hugo)

The build succeeded with the above message. To suppress it, a switch to another CI runner will do. The associated GitLab CI config file was copied from Hugo’s documentation with some customizations for Hugo sample sites

[Read More]

Git URL Shortener Exception

A URL lengthened by git.io

Due to limitations on the number of characters imposed by the site owner, URL shorteners are useful for shortening comments containing URL(s). Nonetheless, while commenting on my recent PR for Introduction, I found that GitHub’s URL shortener had lengthened the URL for GitHub’s home page.

github home page short url

Output of "https://github.com" by GitHub's URL Shortener

A counterexample of GitHub's URL Shortener

Compare these two URLs.

https://github.com
https://git.io/xE9D
GitHub 

Staticman Invitation is Case Sensitive

A recent invitation error under Staticman v3

HTML and URL links are case insensitive. For example, GOOGLE.COM and google.com give the same address. As a result, after creating my fork of Beautiful Jekyll, I invited @staticmanlab to join my GitHub repo by firing the URL

https://staticman3.herokuapp.com/v3/connect/github/vincenttam/beautiful-jekyll

but I got

SCSS to SASS Converter

Background

While porting Minimal Mistakes and Beautiful Hugo’s Staticman support to Introduction, I searched for “SCSS to SASS” on DuckDuckGo. The search engine returned results on “CSS to SASS/SCSS” or vice versa. The first theme has Staticman code in SCSS. That would fit into the third theme’s directory structure, which puts SASS files under assets/sass. However, SASS doesn’t have curly braces {}. I feared that after hours of tedious manual replacement, the code would fail to run. As a consequence, I conducted such Internet search.

[Read More]
SASS  SCSS 

Weak LLN Practice

My intended answer to a weak LLN problem on Math.SE.

Problem: Suppose $(X_n)$ is a sequence of r.v’s satisfying $P(X_n=\pm\ln (n))=\frac{1}{2}$ for each $n=1,2\dots$. I am trying to show that $(X_n)$ satisfies the weak LLN.

The idea is to show that $P(\overline{X_n}>\varepsilon)$ tends to 0, but I am unsure how to do so.

My solution: As in the accepted answer in OP’s previous question https://math.stackexchange.com/q/3021650/290189, I’ll assume the independence of $(X_n)$. By Chebylshev’s inequality,

[Read More]

Staticman Lab New Logos

StaticmanLab new logo

StaticmanLab's new logo

GitLab logo recreated from Wikimedia's logo by Darby under CC-BY-SA 4.0 and Staticman logo on GitHub by Erlen Masson under MIT.

The old icon for Staticman Lab was made by GIMP from Staticman’s icon in PNG in the GitHub repo. Recently, I’ve found the SVG version of this icon. To serve customers better, I’ve recreated the logo from this SVG file so that the edges in the logo become sharper.

[Read More]

Solution to a $p$-test Exercise

I intended to answer Maddle’s $p$-test question, but T. Bongers has beaten me by two minutes, so I posted my answer here to save my work.

The problem statement

This is the sum: $$\sum\limits_{n=3}^\infty\frac{1}{n\cdot\ln(n)\cdot\ln(\ln(n))^p}$$ How do I tell which values of $p$ allow this to converge? The ratio test isn’t working out for me at all.

Unpublished solution

The integral test will do.

$$ \begin{aligned} & \int_3^{+\infty} \frac{1}{x\cdot\ln(x)\cdot\ln(\ln(x))^p} \,dx \\ &= \int_3^{+\infty} \frac{1}{\ln(x)\cdot\ln(\ln(x))^p} \,d(\ln x) \\ &= \int_3^{+\infty} \frac{1}{\ln(\ln(x))^p} \,d(\ln(\ln(x))) \\ &= \begin{cases} [\ln(\ln(\ln(x)))]_3^{+\infty} & \text{if } p = 1 \\ \left[\dfrac{[\ln(\ln(x))}{p+1}]^{p+1} \right]_3^{+\infty} & \text{if } p \ne 1 \end{cases} \end{aligned} $$

When $p \ge 1$, the improper integral diverges. When $p < 1$, it converges.

[Read More]

Merge GitHub Pull Requests

Aim

To merge a pull request.

How?

Let’s take Staticman PR 231 as an example. I would like to test it before commiting this merget to Heroku.

$ cd ~/staticman
$ git branch -a
* deploy
  dev
  master
  ...
$ git remote -v
eduardoboucas https://github.com/eduardoboucas/staticman.git (fetch)
eduardoboucas https://github.com/eduardoboucas/staticman.git (push)
heroku  https://git.heroku.com/staticman3.git (fetch)
heroku  https://git.heroku.com/staticman3.git (push)
...
$ git pull eduardoboucas pull/231/head:deploy
remote: Enumerating objects: 10, done.
remote: Counting objects: 100% (10/10), done.
remote: Total 18 (delta 10), reused 10 (delta 10), pack-reused 8
Unpacking objects: 100% (18/18), done.
From https://github.com/eduardoboucas/staticman
 ! [rejected]        refs/pull/231/head -> deploy  (non-fast-forward)

I executed the last command on branch dev. I didn’t have time to figure out the reason for this error. The following commands should work.

[Read More]