锘??xml version="1.0" encoding="utf-8" standalone="yes"?>国产精品无码久久久久,久久久久亚洲av成人网人人软件
,午夜精品久久久久9999高清http://www.shnenglu.com/wythern/X presents Y for a better Zzh-cnFri, 09 May 2025 04:14:12 GMTFri, 09 May 2025 04:14:12 GMT60[杞琞鍦↙inux涓嬪浣曞垱寤簉amdiskhttp://www.shnenglu.com/wythern/archive/2020/02/26/217165.htmlwythernwythernWed, 26 Feb 2020 07:17:00 GMThttp://www.shnenglu.com/wythern/archive/2020/02/26/217165.htmlhttp://www.shnenglu.com/wythern/comments/217165.htmlhttp://www.shnenglu.com/wythern/archive/2020/02/26/217165.html#Feedback0http://www.shnenglu.com/wythern/comments/commentRss/217165.htmlhttp://www.shnenglu.com/wythern/services/trackbacks/217165.htmlRefer to How to Easily Create Ramdisk on Linux
This tutorial will show you how to quickly create a RAM disk in any Linux distro (Debian, Ubuntu, Linux, Fedora, Arch Linux, CentOS, etc). Compared to commercial Windows RAM disk software that costs money, Linux can utilize this cool feature 100% free of charge.
What is RAM Disk?
RAM disk is also known as RAM drive. It’s a portion of your RAM that are formated with a file system. You can mount it to a directory on your Linux system and use it as a disk partition.
Why use RAM disk?
RAM is ultra-fast compared to even the fastest solid state drive (SSD). As you may know, the main performance bottleneck in today’s computer is the speed of hard drive, so moving programs and files to the RAM disk yields super fast computing experience.
Pros of RAM disk:
Ultra-fast
Can sustain countless reads and writes
Cons of RAM disk:
RAM is volatile which means all data in RAM disk will be lost when the computer shutdowns or reboots. However, this can be a pro in some situations, if you use it wisely.
RAM is expensive so it has limited capacity. You need to make sure not allocate too much space for RAM disk, or the operating system would run out of RAM.
You can do a lot of interesting things with RAM disk.
RAM disk is best suited for temporary data or caching directories, such as Nginx FastCGI cache. If you use a SSD and there will be a lot of writes to a particular directory, you can mount that directory as a RAM disk to reduce wear out of SSD.
I also use RAM disk to temporary store screenshots when writing articles on this blog, so when my computer shut down, those screenshots will automatically be deleted on my computer.
You may not believe it, but I use RAM disk to run virtual machines inside VirtualBox. My SSD is about 250G. I can’t run many VMs directly on the SSD and I’m not happy about the speed of my 2TB mechanical hard drive (HDD). I can move the VM from HDD to RAM disk before starting the VM, so the VM can run much faster. After shutting down the VM, I move the VM files back to HDD, which takes less than 1 minute. This of course requires your computer to have a large capacity RAM.
How to Create a RAM Disk in Any Linux Distro
First make a directory which can be anywhere in the file system such as
sudo mkdir /tmp/ramdisk
If you want to let every user on your Linux system use the RAM disk, then change its permission to 777.
sudo chmod 777 /tmp/ramdisk
Next, check how much free RAM are left on your system with htop command line utility because we don’t want to use too much RAM.
htop
Then all left to do is to specify the file system type, RAM disk size, device name and mount it to the above directory. You can see from the screenshot above that I have plenty of free RAM, so I can easily allocate 1GB for my RAM disk. This can be done with the following one-liner. It will be using tmpfs file system and its size is set to 1024MB. myramdisk is the device name I gave to it.
sudo mount -t tmpfs -o size=1024m myramdisk /tmp/ramdisk
To allocate 10G for the RAM disk, run this instead.
sudo mount -t tmpfs -o size=10G myramdisk /tmp/ramdisk
If we issue the following command
mount | tail -n 1
We can see it’s successfully mounted.
Now if I copy my VirtualBox machines file (5.8G) into the RAM disk, my RAM usage suddenly goes up to 9.22G.
If I unmount RAM disk,
sudo umount /tmp/ramdisk/
Everything in that directory will be lost and RAM usage goes down to original.
This is how you can test if your RAM disk is working.
Test RAM Disk Speed
To test write speed of RAM disk, you can use dd utility.
x-gvfs-show will let you see your RAM disk in file manager. Save and close the file. Your Linux system will automatically mount the RAM disk when your computer boots up.
To mount it immediately without reboot, run the following command.
]]>How to shuffle arrays and slices in Gohttp://www.shnenglu.com/wythern/archive/2019/01/17/216208.htmlwythernwythernThu, 17 Jan 2019 12:27:00 GMThttp://www.shnenglu.com/wythern/archive/2019/01/17/216208.htmlhttp://www.shnenglu.com/wythern/comments/216208.htmlhttp://www.shnenglu.com/wythern/archive/2019/01/17/216208.html#Feedback0http://www.shnenglu.com/wythern/comments/commentRss/216208.htmlhttp://www.shnenglu.com/wythern/services/trackbacks/216208.html鍦ㄦ
]]>go test 鐢╝rgs甯﹀弬鏁?/title>http://www.shnenglu.com/wythern/archive/2018/08/14/215845.htmlwythernwythernTue, 14 Aug 2018 09:04:00 GMThttp://www.shnenglu.com/wythern/archive/2018/08/14/215845.htmlhttp://www.shnenglu.com/wythern/comments/215845.htmlhttp://www.shnenglu.com/wythern/archive/2018/08/14/215845.html#Feedback0http://www.shnenglu.com/wythern/comments/commentRss/215845.htmlhttp://www.shnenglu.com/wythern/services/trackbacks/215845.html嫻嬭瘯涓兂閫氳繃鍛戒護琛屼紶閫掍竴浜涘弬鏁扮粰test func錛岀綉涓婃壘浜嗕竴浜涜祫鏂欎絾榪囩▼涓嶆槸寰堥『鍒╋紝榪欓噷璁板綍涓涓嬨?/div>
/*
Package flag implements command-line flag parsing.
Usage:
Define flags using flag.String(), Bool(), Int(), etc.
This declares an integer flag, -flagname, stored in the pointer ip, with type *int.
import "flag"
var ip = flag.Int("flagname", 1234, "help message for flagname")
If you like, you can bind the flag to a variable using the Var() functions.
var flagvar int
func init() {
flag.IntVar(&flagvar, "flagname", 1234, "help message for flagname")
}
Or you can create custom flags that satisfy the Value interface (with
pointer receivers) and couple them to flag parsing by
flag.Var(&flagVal, "name", "help message for flagname")
For such flags, the default value is just the initial value of the variable.
After all flags are defined, call
flag.Parse()
to parse the command line into the defined flags. */
]]>What is shade jar, and what is its purpose.http://www.shnenglu.com/wythern/archive/2017/06/19/215009.htmlwythernwythernMon, 19 Jun 2017 03:23:00 GMThttp://www.shnenglu.com/wythern/archive/2017/06/19/215009.htmlhttp://www.shnenglu.com/wythern/comments/215009.htmlhttp://www.shnenglu.com/wythern/archive/2017/06/19/215009.html#Feedback0http://www.shnenglu.com/wythern/comments/commentRss/215009.htmlhttp://www.shnenglu.com/wythern/services/trackbacks/215009.html
Uber JAR, in short, is a JAR containing everything.
Normally in Maven, we rely on dependency management. An artifact contains only the classes/resources of itself. Maven will be responsible to find out all artifacts (JARs etc) that the project depending on when the project is built.
An uber-jar is something that take all dependencies, and extract the content of the dependencies and put them with the classes/resources of the project itself, in one big JAR. By having such uber-jar, it is easy for execution, because you will need only one big JAR instead of tons of small JARs to run your app. It also ease distribution in some case.
Just a side-note. Avoid using uber-jar as Maven dependency, as it is ruining the dependency resolution feature of Maven. Normally we create uber-jar only for the final artifact for actual deployment or for manual distribution, but not for putting to Maven repository.
Update: I have just discovered I haven't answered one part of the question : "What's the point of renaming the packages of the dependencies?". Here is some brief updates and hopefully will help people having similar question.
Creating uber-jar for ease of deployment is one use case of shade plugin. There are also other common use cases which involve package renaming.
For example, I am developing Foo library, which depends on a specific version (e.g. 1.0) of Bar library. Assuming I cannot make use of other version of Bar lib (because API change, or other technical issues, etc). If I simply declare Bar:1.0 as Foo's dependency in Maven, it is possible to fall into a problem: A Qux project is depending on Foo, and also Bar:2.0 (and it cannot use Bar:1.0 because Qux needs to use new feature in Bar:2.0). Here is the dilemma: should Qux use Bar:1.0 (which Qux's code will not work) or Bar:2.0 (which Foo's code will not work)?
In order to solve this problem, developer of Foo can choose to use shade plugin to rename its usage of Bar, so that all classes in Bar:1.0 jar are embedded in Foo jar, and the package of the embedded Bar classes is changed from com.bar to com.foo.bar. By doing so, Qux can safely depends on Bar:2.0 because now Foo is no longer depending on Bar, and it is using is own copy of "altered" Bar located in another package.