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
Tag: X
How to un-trust a computer that I have trusted with iOS 7 device?
Posted onHow 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 onHow 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 onHow 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
Running Chrome over SSH tunnel
Posted onHow to run Chrome on remote host over a SSH tunnel? This way, I can access resource that can only be accessed inside the remote host’s network. Running Chrome over a SSH tunnel is much easier than running Firefox over SSH from a Linux host: First, ssh to the remote host with -X option: ssh
Read more
How to convert between dos and unix file coding in Emacs?
Posted onHow 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).
Replacing tabs with spaces in Emacs
Posted onHow to replace tabs with spaces in Emacs? You can first select the regions of text for converting/replacing, then run M-x untabify to replace all tabs with appropriate number of spaces. There is also a M-x tabify for replacing sequences of spaces to tabs. There are also commands to convert tabs to spaces or vice
Read more
How to fetch a webpage as a mobile browser with curl on Linux?
Posted onOn 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 onWhat 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 set up the Java environment in Linux?
Posted onI am using Fedora 20. I installed the rpm from Oracle for the Oracle JDK. How to set up the environment so that the Java environment is Oracle JDK instead of the OpenJDK? The Oracle JDK is install to /usr/java/ directory. On my Fedora 20, it looks like this: $ ls /usr/java -l total 4
Read more
How to reset the keyboard set by xmodmap on Linux?
Posted onHow to reset the keyboard set by xmodmap on Linux? You can reset your keyboard settings by: setxkbmap or setxkbmap -option depending on the way the keyboard was set by xmodmap.
How to swap alt and ctrl on Linux for Emacs?
Posted onHow to swap alt and ctrl on Linux for Emacs? It will be more easier to press the ctrl keys which is a very important key for Emacs. You can make of xmodmap. Save this as a file modmap: clear control clear mod1 keycode 64 = Control_L NoSymbol Control_L keycode 37 = Alt_L Meta_L Alt_L
Read more
How to make Emacs run in command line by default?
Posted onHow 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 onIs 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 onHow 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 onKindle 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 onHow 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 onutop 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 onHow 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 onAfter 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