随笔分类 -  Linux

上一页 1 2 3 下一页
质数
摘要:数学,永远是那么神奇!1.质数是其中一个永久的话题,今天在stackoverflow上又看到一奇贴,分享之。是关于Python生成质数的,有兴趣研究的,请做好长时间Google的准备。http://stackoverflow.com/questions/2068372/fastest-way-to-list-all-primes-below-n-in-python2.RSA算法也离不开质数,而且是大质数,其实Linux下的openssl可以通过命令行验证和生成大质数。$ openssl prime 1313 is prime$ openssl prime -generate -bits 102 阅读全文
posted @ 2012-10-05 23:08 eshizhan 阅读(546) 评论(0) 推荐(0)
ArchLinux下中文字体及主题配置心得
摘要:只是介绍我在ArchLinux折腾中文字体及主题的心得,仅供参考。主要参考Arch Wiki,有几点注意下:1.英文字体一般会使用ttf-dejavu,中文字体使用wqy-microhei(yaourt),但个人感觉ttf-dejavu没有wqy-microhei看上去舒服,因此没有安装ttf-dejavu,于是出现了一些问题,midori中monospace字体会显示不完整,应该是没有识别mono字体的缘故。解决办法:编辑/etc/fonts/conf.avail/65-wqy-microhei.confView Code <?xml version="1.0"?& 阅读全文
posted @ 2012-10-03 12:17 eshizhan 阅读(20018) 评论(0) 推荐(0)
GRUB引导Win8,Win7,Ubuntu
摘要:与时俱进,装了Win8 RTM,我是直接光盘引导,安装在其中一个分区的。发现Win8安装过程是将原有Win7的Bootmgr和BCD覆盖升级并加入Win8引导项目,换句话说,Win7和Win8是共用一个Bootmgr和BCD的,这使得GRUB无法直接引导Win7和Win8,需要在进入Bootmgr后在选择,能不能直接在GRUB中直接集成Ubuntu,Win7,Win8引导项目呢?当然可以。1.原理Win7,Win8操作系统引导原理简简介POST->MBR->VBR(PBR)->Bootmgr->BCD->winload.exe->ntoskrnl.exe.. 阅读全文
posted @ 2012-08-22 11:38 eshizhan 阅读(10858) 评论(0) 推荐(1)
[转]Linux命令技巧大全
摘要:来源:http://blog.csdn.net/tge7618291/article/details/7587516Linux的Shell很强大,当你越了解它,他就会越强大。从网络摘抄,感觉很全面,很实用,收藏之。感谢原作者!1. some cmds7za (^ 压缩和解压缩 *.7z 文件 ^)alsamixer -c0 (^ 打开声音控制器 ^)apropos keyword (^ 如果你想实现某种功能, 但是不知道该使用什么命令, 你可以试试apropos命令 ^)arch (^ 返回机器的类型 ^)ar ruv libcii.a f1.o f2.o f3.o (^ 创建静态库 ^)aw 阅读全文
posted @ 2012-08-07 11:00 eshizhan 阅读(1718) 评论(0) 推荐(1)
Resolve Windows hostname without samba in Linux
摘要:1.First install samba2.set /etc/nsswitch.conf, add "wins"...hosts: files wins dns...3.test$ ping HOSTNAME4.backup /usr/lib/libnss_wins.so$ sudo cp /usr/lib/libnss_wins.so{,.bak}5.remove samba6.restroe/usr/lib/libnss_wins.so$ sudo cp /usr/lib/libnss_wins.so{.bak,}$ sudo ln -s libnss_wins.so 阅读全文
posted @ 2012-07-21 18:08 eshizhan 阅读(378) 评论(0) 推荐(0)
The vim syntax of systemd unit file
摘要:project:http://fedorapeople.org/gitweb?p=wwoods/public_git/vim-scripts.git;a=summaryadd two files/usr/share/vim/vim73/syntax/systemd.vimand/usr/share/vim/vimfiles/ftdetect/systemd.vim 阅读全文
posted @ 2012-07-19 00:01 eshizhan 阅读(312) 评论(0) 推荐(0)
Urxvt最简配置
摘要:最简单的配置,主要是颜色和字体,自己记录下,有时间在研究更多的参数:URxvt.font:xft:WenQuanYi Micro Hei Mono:size=11:style=Regular:antialias=true,xft:WenQuanYi Micro Hei Mono:size=10:style=Regular:antialias=trueURxvt.boldfont:xft:WenQuanYi Micro Hei Mono:size=11:style=Bold:antialias=true,xft:WenQuanYi Micro Hei Mono:size=10:style=Bol 阅读全文
posted @ 2012-07-17 10:37 eshizhan 阅读(2003) 评论(0) 推荐(0)
SSH反向连接及Autossh
摘要:0.接触Linux恐怕对SSH再熟悉不过了,还有scp,sftp各种方便的功能,一般的使用都需要ip:port(如果不是默认22的话),但有些情况比较特殊,就是想连接一台内网主机(比如公司内网,当然你肯定做不了Port Forwarding,除非你想在公司防火墙上拆个洞)。稍懂一点网络的童鞋会明白,Internet上去主动连接一台内网是不可能的,一般的解决方案分两种,一种是端口映射(Port Forwarding),将内网主机的某个端口Open出防火墙,相当于两个外网主机通信;另一种是内网主机主动连接到外网主机,又被称作反向连接(Reverse Connection),这样NAT路由/防火墙就 阅读全文
posted @ 2012-07-16 00:57 eshizhan 阅读(50631) 评论(0) 推荐(4)
xcompmgr error on openbox
摘要:Q:When you iconify and restore a window, cpu is very high, and the window not to show.The cosole show error message like this:error 8: BadMatch (invalid paramter attributes) request 156 minor 6 serial 2325error 9: BadDrawable (invalid Pixmap or Window parmater) request 153 minor 4 serial 2326error 4 阅读全文
posted @ 2012-06-03 22:21 eshizhan 阅读(490) 评论(0) 推荐(0)
sudo echo permission denied
摘要:Q:$ sudo echo 'some' > test-bash: test: Permission deniedA:$ sudo sh -c "echo 'some' > test"Or$ echo 'some' | sudo tee [-a] testtee -a = append 阅读全文
posted @ 2012-05-30 09:30 eshizhan 阅读(937) 评论(0) 推荐(0)
USB Mulit Boot by GRUB2
摘要:grub.cfg:set timeout=1set default=0menuentry "ArchLinux-2012.01-1-archboot.iso" { set isofile="/boot/iso/archlinux-2012.01-1-archboot.iso" loopback loop $isofile linux (loop)/boot/vm64 ro initrd (loop)/boot/initrd64.img}# see GRUB2 - ArchWiki [via]menuentry "ArchLinux-2011.0 阅读全文
posted @ 2012-04-24 10:30 eshizhan 阅读(4628) 评论(0) 推荐(0)
关于GRUB2引导grub4dos时"--config-file"参数失效的问题
摘要:当从grub2引导grub4dos时,参数"--config-file"没有效果,直接进入命令行。原因可能是个Bug,GRUB在参数处理上出现了问题,我的版本是GNU GRUB 2.00~beta2,不过看帖子上,GRUB从1.99可能就存在这个问题。这里:http://reboot.pro/15422/page__view__findpost__p__143239Q:when boot grub4dos from grub2, the parameter "--config-file" no effect.menuentry "WinPE-2 阅读全文
posted @ 2012-04-13 11:11 eshizhan 阅读(2692) 评论(0) 推荐(0)
Linux查看网络即时网速
摘要:sar -n DEV 1 100 1代表一秒统计并显示一次 100代表统计一百次 使用ntop等工具,就更方便简单了,不过这个更灵活 P.S. sar在sysstat包 P.P.S 更多监控工具,参考:Linux监控工具 (Linux Monitor Tools) 阅读全文
posted @ 2012-04-11 01:16 eshizhan 阅读(52073) 评论(1) 推荐(1)
压缩虚拟机硬盘(VMDK VDI)大小
摘要:本文只介绍手动压缩方法。1.首先要在Guest系统上,把所有没用的数据写零*NIX,执行:dd if=/dev/zero of=/bigemptyfilerm /bigemptyfileWindows,执行(sdelete.exe):sdelete -c -z C:\2.关闭Guest,开始压缩硬盘文件Virtual Box:VBoxManage modifyhd --compact my_hd.vdiVMware:vmware-vdiskmanager -k my_hd.vmdk[via] [vmware-vdiskmanager_SDelete.zip] 阅读全文
posted @ 2012-04-10 22:11 eshizhan 阅读(6526) 评论(0) 推荐(0)
ArchLinux Update
摘要:Q:filesystem: /etc/mtab exists in filesystemA:pacman -S filesystem --force[via]Q:initscrpts: /etc/profile.d/locale.sh exists in filesystemA:mv /etc/profile.d/locale.sh /etc/profile.d/locale.sh.old[via]Q:After updating my system, Can't into graphical mode on Virtual BoxA:reinstall VBox Guest Addi 阅读全文
posted @ 2012-04-10 21:21 eshizhan 阅读(486) 评论(0) 推荐(0)
GRUB Boot SliTaz 4.0 iso
摘要:You need merge four rootfs*.gz in one.cat rootfs4.gz rootfs3.gz rootfs2.gz rootfs1.gz > rootfs.gzand copy new rootfsgz to /boot, then create new iso file.grub.cfgmenuentry "SliTaz-4.0-RC3.iso" { set isofile="/boot/iso/slitaz-4.0-rc3.iso" loopback loop $isofile linux (loop)/boo 阅读全文
posted @ 2012-04-10 17:55 eshizhan 阅读(1337) 评论(0) 推荐(0)
waiting 30 seconds for device /dev/disk/by-label/XXXX error: boot device didn't show up after 30 seconds
摘要:Q:when grub2 boot archLinux 2011.08.19 iso file, the error is:waiting 30 seconds for device /dev/disk/by-label/XXXXerror: boot device didn't show up after 30 secondsA:mkdir /cdrommount -t vfat /dev/sda1 /cdrommodprobe looplosetup /dev/loop6 /cdrom/boot/iso/archlinux-2011.08.19-core-i686.isoln -s 阅读全文
posted @ 2012-04-06 15:54 eshizhan 阅读(5070) 评论(0) 推荐(0)
笔记本电脑安装Mac OS X / Linux后硬盘出现异响
摘要:临床症状为硬盘出现当当的金属碰撞声,这是磁头归位的声音,一个bug。其实不能算bug只是硬盘电源管理中一种节能功能,磁头归位后是为了硬盘停转。Mac OS X解决办法,安装hdpam,http://mckinlay.net.nz/hdapmLinux也会出现该问题,解决办法是将hdparm -B 254 /dev/sdX加入开机脚本rc.local,将/dev/sdX设为你要更改的硬盘。P.S.我的硬盘是日立的,官方提供一个工具ftool,可以将配置写入硬盘CMOS,这样就更彻底了。 阅读全文
posted @ 2012-01-03 03:24 eshizhan 阅读(1204) 评论(0) 推荐(0)
error while loading shared libraries: libxcb-aux.so.0: cannot open shared object file
摘要:Q:openbox: error while loading shared libraries: libxcb-aux.so.0: cannot open shared object file: No such file or directoryA:Because xcb-util-0.3.6 update to xcb-util-0.3.8 ChangeLog: commit 118a3c86b3d3b2fab20f365e4a5703e40ad2e1b1 Author: Arnaud Fontaine <arnau@debian.org> Date: Mon Aug 9 15: 阅读全文
posted @ 2012-01-02 11:07 eshizhan 阅读(983) 评论(0) 推荐(0)
The easy way to execute sudo command in Python using subprocess.Popen
摘要:run a command as root using sudo from Python: 1 import subprocess 2 3 def mypass(): 4 mypass = '123' #or get the password from anywhere 5 return mypass 6 7 echo = subprocess.Popen(['echo',mypass()], 8 stdout=subprocess.PIPE, 9 )10 11 sudo = ... 阅读全文
posted @ 2011-12-29 09:59 eshizhan 阅读(3433) 评论(0) 推荐(1)

上一页 1 2 3 下一页