How to run gitbook on a headless server (make Calibre run in headless server)?

Posted on

When use gitbook to generate ebook, Calibre reports this: RuntimeError: X server required. If you are running on a headless machine, use xvfb After xvfb is installed, it does not work either. How to make gitbook/Calibre work on a headless server? You need to wrap the command ebook-convert with xvfb-run. However, in gitbook (lib/generate/ebook/index.js), ebook-convert
Read more

How to un-trust a computer that I have trusted with iOS 7 device?

Posted on

How to un-trust a computer that I have trusted with iOS 7 device, such as iPhone? You can delete the Lockdown folder to reset the trust/un-trust status of iPhones. Apple provides tutorials for Max OS X and Windows at: http://support.apple.com/kb/TS5335 (archived) . If you are using Linux, the Lockdown folder is: /var/lib/lockdown Answered by Lucy.

How to install multiple versions of sbt on my Linux host?

Posted on

How to install multiple versions of sbt on my Linux host For example, some projects use 0.12.x while some use 0.13.x. Installing neither in the system only is not sufficient enough. You may use the excellent sbt-extras: https://github.com/paulp/sbt-extras Most of the time, it detects the version of sbt needed in the project direoctory automatically: [zma@office
Read more

How to package a Scala project to a .jar with sbt?

Posted on

How to package a Scala project to a .jar file with sbt? Manually packaging the .class files are fine but too tedious. A jar of just the project classes The command: sbt package will produces the main artifact as a jar into target/scala-2.x.y/project_name_2.x.y-zz.jar. Continuously building the package: sbt ~package Standalone jar with all dependencies If
Read more

How to convert between dos and unix file coding in Emacs?

Posted on

How to convert between dos and unix file coding for files in Emacs? From Dos to Unix coding: M-x set-buffer-file-coding-system RET undecided-unix or C-x RET f undecided-unix Then save the file (C-x C-s). From Unix to Dos M-x set-buffer-file-coding-system RET undecided-dos or C-x RET f undecided-dos Then save the file (C-x C-s).

How to fetch a webpage as a mobile browser with curl on Linux?

Posted on

On Linux, how to download a webpage as a mobile browser? You can change the agent of curl to be a mobile browser’s and the remote webserver may be consider the request from a mobile browser: curl -A “Mozilla/5.0 (iPhone; CPU iPhone OS 6_1_3 like Mac OS X) AppleWebKit/536.26 (KHTML, like Gecko) CriOS/28.0.1500.12 Mobile/10B329 Safari/8536.25”
Read more

Bash comparison operators

Posted on

What are all the bash supported comparison operators? The man 1 test contains all the operators supported in bash. An omitted EXPRESSION defaults to false. Otherwise, EXPRESSION is true or false and sets exit status. It is one of: ( EXPRESSION ) EXPRESSION is true ! EXPRESSION EXPRESSION is false EXPRESSION1 -a EXPRESSION2 both EXPRESSION1
Read more

How to make Emacs run in command line by default?

Posted on

How to make Emacs run in command line by default? I do not want to open the X window. You have at least 2 choices. First choice: use emacs-nox and make it the default: # yum install emacs-nox # alternatives –config emacs and choose emacs-nox. Second choice: use emacs but with -nw to disable the
Read more

Multi-connection multi-part file downloading tools on Linux

Posted on

Is there any good multi-connection multi-part file downloading tools on Linux? wget is great but can only make 1 connection for 1 file. Sometimes, it is too slow on some networks. I use aria2 which supportsmMulti-connection download. aria2 can download a file from multiple sources/protocols and tries to utilize your maximum download bandwidth. Really speeds
Read more

How to make xterm display Chinese characters?

Posted on

How to make xterm display Chinese characters? It just displays some small rectangles for Chinese characters. First, the settings for some old X programs like xterm is in ~/.Xresources. And it takes effect after the X server restarts, or you can manually load the settings by xrdb -merge ~/.Xresources Second, the Chinese or similar fonts
Read more

How to convert A4 paper format to read on Kindle 5

Posted on

Kindle is good for reading. However, the A4-size technical/academic paper is pain to read on Kindle 5—the fonts are too small. The “email to Kindl” converting tool provided by Amazon usually loses the formats in the technical paper. How to convert A4 paper format to read on Kindle 5? I use k2pdfopt tool (hey, source
Read more

How to convert a .docx .doc MS Word file to pdf in command line on Linux

Posted on

How to convert a MS Word document file such as .docx and .doc to pdf on Linux using command line tools? Use LibreOffice: libreoffice –headless –convert-to pdf –outdir /path/to/out/dir/ /path/to/doc/docx/file While this LibreOffice answer works, the –headless option still needs as display, even though it does not use it. In otherwords, this option won’t work
Read more

utop key bindings / key shortcuts

Posted on

utop is an improved toplevel for OCaml supporting line edition, history, real-time and context sensitive completion, colors and etc. utop is convenient to use. However, the key bindings are a little bit different from the ones with GNU readline. What are all the key bindings? The #utop_bindings command will print all the key bindings. Here
Read more

How to get the assembly code for OCaml code generated by ocamlopt?

Posted on

How to get the native assembly code (e.g. x86-64 asm) for OCaml code generated by the native ocamlopt compiler? To get the assembly code for an OCaml program, add these parameters to ocamlopt: -S -inline 20 -nodynlink An example is as follows. The OCaml program: $ cat not.ml let not x = ((x – 1)
Read more

How to repair a MySQL table?

Posted on

After a server crash and restarting, MyBB reports a SQL Error as follows: MyBB SQL Error MyBB has experienced an internal SQL error and cannot continue. SQL Error: 145 – Table ‘./mybb/mybb_sessions’ is marked as crashed and should be repaired Query: SELECT * FROM mybb_sessions WHERE sid=’40021925bd0494ea31…’ AND ip=’x.x.x.x’ LIMIT 1 The dababase is MySQL.
Read more