Grub fails to boot with Windows 8 UEFI after installing Fedora 20. The Grub entry for Windows 8 is: menuentry ‘Windows Boot Manager’ { chainloader /EFI/Microsoft/Boot/bootmgfw.efi boot } How to fix it? The set root= is missing. You probably can fix this by specifying the root manually: menuentry ‘Windows Boot Manager’ { insmod part_gpt set
Read more
Tag: Tutorial
How to find which hard drives a LVM volume uses?
Posted onHow to find which hard drives a LVM volume uses to decide which volume will be affected if a disk failes. You can use lvdisplay with the –maps option to display the the mapping of logical extents to physical volumes and physical extents: # lvdisplay –maps To map physical extents to logical extents, use #
Read more
How to erase disk partitions on U disks on Windows?
Posted onHow to erase disk partitions on U disks on Windows? Check the HDD LLF low level format tool: http://hddguru.com/software/HDD-LLF-Low-Level-Format-Tool/ It is free for personal usage. Run it as Adminiatrator and you can choose to erase partitions and MBR on the U disks. Be careful that the operation is is recoverable.
How to download a youtube video to my computer?
Posted onHow to download a youtube video to my computer? You may use the ClipConverter.cc for downloading Youtube videos: http://www.clipconverter.cc/ How to download a YouTube video: Paste your YouTube URL at ‘Media URL’ and press Continue. Select the format and the options for the conversion. The default options are for most videos a good setting. Press
Read more
Replacing with a string with newline in Emacs?
Posted onHow to replacing a string with another string with newline in Emacs? For example, to replace: good editor with good editor: Emacs What you need is actually to input a newline in Emacs: C-q C-j C-q is for quoted-insert, and C-j is a newline (0xa).
Emacs Remembering Last Editing Positions
Posted onHow 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
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
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
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 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 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 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