I want to include a link to a Gist in an Octopress codeblock.
In the syntax for a codeblock, the link is too long. This can cause problems in a graphical frontend of Git, such as gitk.
I found a post about GitHub URL Shortener by accident.
$ curl -i https://git.io -F "url=https://github.com/vincenttam" -F "code=vtam"
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 293 100 29 100 264 40 367 --:--:-- --:--:-- --:--:-- 375HT
TP/1.1 100 Continue
HTTP/1.1 201 Created
Server: Cowboy
Connection: keep-alive
Date: Tue, 10 Jan 2017 22:50:08 GMT
Status: 201 Created
Content-Type: text/html;charset=utf-8
Location: https://git.io/vtam
Content-Length: 29
X-Xss-Protection: 1; mode=block
X-Content-Type-Options: nosniff
X-Frame-Options: SAMEORIGIN
X-Runtime: 0.111560
X-Node: 6a832541-d7fa-4b2b-9a4b-1e3355ad0eab
X-Revision: 4fdc60de6311e6a3aa31e19bc7b3aad7e85d33a6
Strict-Transport-Security: max-age=31536000; includeSubDomains
Via: 1.1 vegur
https://github.com/vincenttam
In fact, git.io is much simpler for users who don’t type commands.
I created three short URLs with this tool.
I’m recently enhancing the $\rm \LaTeX$ code for inline limits. For the reason of doing so, you may refer to the external link of my recent linklog Inline Limit Rendering.
In the previous post in this series written over one year ago, I have included a code block which enables deferred MathJax loading. However, I manually added this chuck of code in the HTML file generated by kramdown, which created the problem described in the next subsection A problem with Vim’s folding arised.
Firstly, save the code for loading MathJax in the previous
post in this series in a separate file ~/script.html
. Then
use the following commands within Vim in order to avoid leaving the
current buffer and to improve efficiency.
9,$w! ~/temp.mkd
!kramdown ~/temp.mkd > ~/temp.html
!cat ~/{temp,script}.html > ~/test.html
The digit 9
in the first command isn’t exact. Change it to any
line number that separates the yaml front matter from the
post content.
To know the page layout of a website, notably my blogs, on mobile devices before publishing it.
I used ifconfig
to check the IP address of my desktop where the
preview site was hosted. It’s 192.168.1.5
. When I typed in this
address followed by a colon and the port number 4000
, then the
browser said “connection timeout” after loading for a while.
I spent a day to identify the cause of the problem.
Actually, the website should be hosted at the internal IP address
shown by ifconfig
instead of localhost
. Since I switch off the
router before going to bed every day, the internal IP address for my
desktop changes daily. Therefore, one uses 0.0.0.0
to host the site
on all IP addresses that the machine possesses.
In Jekyll-Bootstrap, one may simply add host : 0.0.0.0
in
_config.yml
; in Octopress, one may find the line containing
server_port
in the middle of Rakefile
and add --host
#{listen_host}
.1
``` ruby Changes in Rakefile http://www.jmlog.com/octopress-preview-config-in-vagrant/ server_port = “4000” # port for preview server eg. localhost:4000 listen_host = “0.0.0.0” # bind to all available IPs
rackupPid = Process.spawn(“rackup –port #{server_port} –host #{listen_host}”) ```
On Ubuntu, I used UFW to open the port 4000
to all devices at home.
(The netmask of my home router has 24 bits, which is the usual
setting.)
sudo ufw allow from 192.168.1.0/24 to any port 4000:4001 proto tcp
Rakefile
which allows the specification of the host address./24
in 192.168.1.0/24
means after reading
this chapter of the guide.A preview of a blog is often needed before it’s published.
However, it is possible that one doesn’t like to type localhost
in
the address bar, and would like to have other names.
The idea is in Local Setup – edit your hosts file in How to test
localhost from any device on your network
written by Wes Bos. On *nix, the file path is still the
same as on OSX, but many users would rather use Vim for editing
/etc/hosts
. One may even use sed
with the -i
flag and
the sudo
privilege in order to directly manipulate this file.
sudo sed -i "3i127.0.0.1\tblogtest.com" /etc/hosts
for insertion
of “127.0.0.1 blogtest.com” before the third line.sudo sed -i "3c127.0.0.1\tblogtest.com" /etc/hosts
for changing
the third line to “127.0.0.1 blogtest.com”.Note that the tab is escaped as \t
in these two commands.
I attempted to manually fix a problem in the first post in this series half a year ago.
I have just updated the Jekyll source code for Blog 2.
[owner@localhost ~/blog2]$ git pull jekyll master
remote: Counting objects: 37, done.
remote: Total 37 (delta 10), reused 10 (delta 10), pack-reused 27
Unpacking objects: 100% (37/37), done.
From github.com:plusjade/jekyll-bootstrap
* branch master -> FETCH_HEAD
3a34785..8193869 master -> jekyll/master
Removing sitemap.txt
Auto-merging _includes/JB/setup
CONFLICT (content): Merge conflict in _includes/JB/setup
Auto-merging _config.yml
Automatic merge failed; fix conflicts and then commit the result.
How to repair this failed merge?
In the file _includes/JB/setup
, I deleted the HEAD
part, and
adopted the official changes in the remote repository for Jekyll.
Then, everything should be fine.