在一台电脑上管理两个github账号,需要大家做以下步骤.
比如说,你有一个126的邮箱和一个gmail邮箱,名字分别取x和y.在.ssh/目录下使用下面的命令:
ssh-keygen -t rsa -C "[email protected]"
ssh-keygen -t rsa -C "[email protected]"
在键入第一条命令的时候,不要一路回车,需要你重命名一下,可以直接以id_rsa_x和id_rsa_y来命令,第二个提示框可以按回车直接进行下一步。这样就会生成四个文件:
id_rsa_x.pub id_rsa_y.pub
id_rsa_x id_rsa_y
上面以*.pub结尾的文件需要你填入你的两个github上面的设置的ssh key and gpg
单击上面的New ssh Key,把pub文件的内容填入对应的ssh的对应框。
ssh-agent -s
ssh-add ~/.ssh/id_rsa_x
ssh-add ~/.ssh/id_rsa_y
Host x.github.com
hostName github.com
PreferredAuthentications publickey
IdentityFile ~/.ssh/id_rsa_x
User x
Host y.github.com
HostName github.com
User y
IdentityFile ~/.ssh/id_rsa_y
ssh -T x.github.com
ssh -T y.github.com
将你的项目_clone_到本地,
git clone [email protected]:wahtever
还有一个重要的问题就是你的git配置文件大部分都设置为了全局文件,那么就要设置新的config文件,这是针对你的项目而言的。
# 取消全局 用户名/邮箱 配置,下面的user.name是你的原来的真实名字
git config --global --unset user.name
git config --global --unset user.email
#为每个repo设置不同的 用户名/邮箱
git config user.email "[email protected]"
git config user.name "x"
git remote rm origin
git remote add origin [email protected]:whatever
# 重新push
git push origin master
Enjoy!
If you have pushed commit into remote,how to reset it? Yes, from literly you know i means.
git reset --soft <版本号>
Notes: --soft
rollback verison before, but it retains the modifies for the local work, then restart push it.
--hard
discards the modify.
git push origin <branch-name> --force
If you use the command without --force
, it will reject.Forcing to over cover remote branch.
Done.
First, you have to understand it: in wireshark, the packet is very important concept.Above, items of menu have
File
,Edit
, View
, Go
,Capture
,Analyze
and they use packets(born from TCP/IP) except file
.
Each line in the packet list corresponds to one packet in the capture file, if you select a line in this pane, more details will be displayed in the “packet pane” and “Packet Bytes” panes.
The picture is very happy:
…
wireshark -i eth0 -k
This will start Wireshark capturing on interface eth0.
Or you click “Capture” -> “Options”, which short key is ctrl + k
. You can add it and linux command ifconfig
into to test.
So, my eth0 is called ‘enp1s0’
This is a new post and it is sister message for http://www.aftermath.cn/kvms-resize.html
First, we can see if the filestsyem has any swap, you can type:
sudo swapon --show
If any thing does not display, this means your system does not have any swap space.
You can verify there is no active swap using free
utility:
free -h
total used free shared buff/cache available Mem: 2.0G 105M 262M 11M 1.6G 1.7G Swap: 0B 0B 0B
Via df -h
to check disk space
sudo fallocate -l 2G /swapfile
The program fallocate
to create a file named swapfile
in our (/) directory.
Because we have a RAM is 1024MB, so we create a swapfile which space is 2G.
ls -hl /swapfile
You can verify it now.
Now, we do not turn this into swap space.Make the file only accessible to root
by typing:
sudo chmod 600 /swapfile
Next, type:
sudo mkswap /swapfile
Then, to start utilizing it:
sudo swapon /swapfile
So, we have finished it.
sudo df -h
sudo free -h
Yes, it is in use on this start,you have to add it into /etc/fstab
First, back up your /etc/fstab
. Then,
echo '/swapfile none swap sw 0 0' | sudo tee -a /etc/fstab
The swappiness
parameter configures how often your system swaps data out of RAM to the space. This is a value between 0 ans 100 that represents a percentage.
If you have a deskop machine, the 60
is ok, but for server, it is better 0.
cat /proc/sys/vm/swappiness
It will show on my machine:
60
We can set the swappiness to a different value by using the sysctl
command.
sudo sysctl.swappiness=10
If you want to it persent permenant , edit /etc/sysvtl.conf
file to add:
vm.swappiness = 10
好不容易使用libvirt库结合qemu把虚拟机装起来,但是没有想到在跑项目的时候居然dik space 太小了,看来是自己当初安装虚拟机的时候把容量给小了,想办法在整回去呗.
首先声明,我使用的是qemu自带的qcow2文件格式,但是好像这个并不会影响的使用。现在,我的kvms已经扩充完毕,有些数据已经拿不到了,但是思路还在的,我可以使用我的笔记再一次演示一遍的.
我的pool文件定义在/opt/kvms/pools/devel/debian-9.qcow2
,
stop your VM
Use qemu-img resize /opt/kvms/pools/devel/debian-9.qcow2 +25G
Restart your VM
Adjust your VM LVM partition
First, the result below is updated,
sudo fdisk -l
Disk /dev/vda: 55 GiB, 59055800320 bytes, 115343360 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: dos
Disk identifier: 0x57a2ec91
Device Boot Start End Sectors Size Id Type
/dev/vda1 * 2048 115343359 115341312 55G 83 Linux
But you must know, my /dev/vda1
is 10G size only,the 55G is result i resized it.
Next we use the fdisk tool to temporarily delete
partition /dev/vda1
,then create it bigger.
Here: section start 2048.
In fact, The fdisk have detected the space is 55G, but my /dev/vda1
is 10G only, because i dont’t resize the /dev/vda1
filesystem.
The process is:
# fdisk /dev/vda
Welcome to fdisk (util-linux 2.27.1).
Changes will remain in memory only, until you decide to write them.
Be careful before using the write command.
Command (m for help): d
Selected partition 1
Partition 1 has been deleted.
Command (m for help): n
Partition type
p primary (0 primary, 0 extended, 4 free)
e extended (container for logical partitions)
Select (default p): p
Partition number (1-4, default 1): 1
First sector (2048-62914559, default 2048): 2048
Last sector, +sectors or +size{K,M,G,T,P} (2048-62914559, default 62914559): [ENTER for default]
Created a new partition 1 of type 'Linux' and of size 30 GiB.
Command (m for help): t
Selected partition 1
Partition type (type L to list all types): 83
Changed type of partition 'Linux' to 'Linux'.
Command (m for help): a
Selected partition 1
The bootable flag on partition 1 is enabled now.
Command (m for help): p
Disk /dev/vda: 30 GiB, 32212254720 bytes, 62914560 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: dos
Disk identifier: 0x3ac5a058
Device Boot Start End Sectors Size Id Type
/dev/vda1 * 2048 62914559 62912512 30G 83 Linux
Command (m for help): w
The partition table has been altered.
Calling ioctl() to re-read partition table.
Re-reading the partition table failed.: Device or resource busy
The kernel still uses the old table. The new table will be used at the next reboot or after you run partprobe(8) or kpartx(8).
First we enter d
to delete a partition, As there is only one partition(/dev/vda1) it is automatically selected.
Next we create a new partioion
n
to start the new partition function
p
for a primary partition
1
to create /dev/vda1
2048
as our start sector
t
is to set partition type, then enter 83
to set it to linux.
To set the bootable, press a
for the boot function and enter 1
if prompted for the partition number.
Enter p
to print the new partition table.
w
is write to the partition table.
Ok, we have finished the partition table.And you have noted the output, you have to use bash command to tell kerenl to load the new partition table.
partprobe /dev/vda
If success there is no output.
The last step is very important for the process, because you donnot resize /dev/vda1 filesystem.We have expanded the partition but the filesystem has not been expanded to fill it. How? resize2fs
resize2fs /dev/vda1
Hope it works!