How to make emacs remember last editing positions in files. It will be convenient next time I open the same file the cursor automatically moves to the position I was last time editing the same file. The behavior seems enabled by default in Vim. How to make Emacs do this? I use the saveplace mode.
Read more
Category: QA
Questions and answers.
Setting up a VPN over SSH
Posted onSSH tunnel and port forwarding is great and convenient to use. But is it possible to set up a VPN like connection over SSH? If you are on Linux or Mac, you can use sshuttle: https://github.com/apenwarr/sshuttle If you are on Windows, you can use ProxyCap: http://www.proxycap.com/index.html Both are great software.
Enlarging Linux UDP buffer size
Posted onOne of the most common causes of UDP data gram lost on Linux is an undersized receive buffer on the Linux socket. How to enlarge Linux UDP buffer size? On Linux, you can change the UDP buffer size (e.g. to 26214400) by (as root): sysctl -w net.core.rmem_max=26214400 The default buffer size on Linux is 131071.
Read more
How to embed mp4 video in HTML pages?
Posted onI have a mp4 video file. How to embed it video in HTML pages? I use this piece of code: In HTML: <video class=”movie” src=”path/to/file.mp4″ controls></video> The CSS for “movie” class: .movie { max-width:1000px; } Here is one example.
How to mark a line as deleted in BBCode?
Posted onHow to mark a line as deleted in BBCode? e.g. a line crossing through the text. You can use the [s] tag. The BBCode: [s]strikethrough text[/s] will be converted <s>strikethrough text</s>, <del>strikethrough text</del> or <span style=”text-decoration: line-through;”>strikethrough text</span> Check more at: http://en.wikipedia.org/wiki/BBCode
fclose Q2A theme
Posted onCan I get the fclose Q2A theme used here? I’d like to share it but I also want to keep my site a little bit unique. What about this: you can get the css and qa-theme.php files, but need to find or design your own icons for the site (I believe some icons from other
Read more
Filter away non-printable ASCII characters on Linux?
Posted onSometimes the commands’ output have some non-printable ASCII characters. How to filter away these non-printable ASCII characters on Linux? You can consider the problem as “how to leave only printable ascii characters?”. The printable characters in ASCII table are: Octal 011: Tab Octal 012: Line Feed Octal 015: Carriage Return Octal 040 to 176: printable
Read more
Hey can I please get your theme?
Posted onTrying to get your q2a theme. Is there a way you could send it on to me please? Would be incredibly appreciated The theme of the site ( https://www.systutorials.com ) is http://wordpress.org/themes/twentyfourteen with minor modifications. Some other features you find on the site are through plugins and HTMLs. If you are asking for the Q2A
Read more
How to calculate the average of value in lines of a text file on Linux by a script?
Posted onHow to calculate the average of value in lines of a text file on Linux by a script? The file.txt is like: Run 0: Time used: 22.235331711 seconds. Run 1: Time used: 20.784491219 seconds. Run 2: Time used: 21.851638876 seconds. What I want it to calculate the average time. awk is handy for this purpose:
Read more
Setting sbt log level at the command line
Posted onsbt‘s log level can be set by execute set logLevel := Level.Error inside sbt. How to set the sbt log level at the command line? Add –error to sbt for specify the logLevel to error: sbt –error “your command”
Patching with git
Posted onTutorials on how to create patches and apply patches with git. A nice tutorial: https://ariejan.net/2009/10/26/how-to-create-and-apply-a-patch-with-git/ Manuals: git format-patch: https://www.systutorials.com/docs/linux/man/1-git-format-patch/git apply: https://www.systutorials.com/docs/linux/man/1-git-apply/
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
How to get the time at millisecond level on Linux with command line?
Posted onI know that gettimeofday() is a nice API. But how to get the number of seconds with milliseconds since the epoch time? You can get the time at nano-seconds level (although it is not guaranteed that the last digits are accurate) by: date +%s.%N
How to get the file length in C on Linux
Posted onHow to get the file length in C on Linux given the address of the file (e.g. “/tmp/a.txt”)? This function returns the length of the file: #include <sys/stat.h> long file_length(char *f) { struct stat st; stat(f, &st); return st.st_size; }
How to Import a CMake project into Eclipse CDT?
Posted onHow to Import a CMake project into Eclipse CDT? For example, the current CMake project source directory is ./src. mkdir ./cdt && cd ./cdt && cmake -G “Eclipse CDT4 – Unix Makefiles” ../src cmake will generate a Eclipse project in ./cdt and you can open it in Eclipse.
How to catch the kill signals sent by kill in C on Linux?
Posted onHow to catch the kill signals sent by the kill command in C programs on Linux? For example, I have a daemon progd running, and will kill it by: pkill progd The question is how to catch the signal sent by the kill command and response to it in the progd program implemented in C
Read more
How to Wrap and NOT Wrap Lines in vim
Posted onHow to Wrap and NOT Wrap Lines in vim? Make vim wrap lines: :set wrap For not wrap which will be useful when reading some data result such as logs: :set nowrap It can also be written into the .vimrc config files
How to force yum not to update certain packages?
Posted onHow to force yum not to update certain packages, such as kernel? I manually compiled a kernel module for a specific kernel version. As long as it works well, I do not want to update it. Another example is that I want a specific version of sbt. How to force yum exclude it from being
Read more
Git branching tutorial
Posted onGood tutorials on git branching. The “Git Branching” chapter of Pro Git book is the best one that I ever seen: http://git-scm.com/book/en/Git-Branching It deserve the time to study the whole chapter. If you are working with a git server, this chapter is especially useful: http://git-scm.com/book/en/Git-Branching-Remote-Branches