2018年5月6日 星期日

Tutorial

(一)RedHat / CentOS / Fedora系統密碼

1.在GRUB選項菜單按E進入編輯模式

2.編輯kernel那行最後加上S(或者Single)

3.按B,啟動到single-user mode

4.進入後執行下列命令

# mount -t proc proc /proc

# mount -o remount,rw /

#passwd

#sync

#reboot


(二)Debian linux系統密碼

1.在grub選項菜單中Debian GNU / Linux,...(recovery mode),按e進入編輯模式

2.編輯kernel那行最後面的ro single改成 rw single init=/bin/bash按b執行重啟

3.進入後執行下列命令

root@(none)#mount -a

root@(none)#passwd root

root@(none)#reboot


(三)Freebsd系統密碼

1.開機進入引導菜單

2.選擇每項(按4)進入單用戶模式

3.進入之後輸入一列命令

root@#mount -a

root@#fsck -y

root@#passwd(修改密碼命令)

root@#root(要破解密碼的用戶名)

Enter new unix password:

root@#init 6 (重啟)


(四)Solaris系統密碼

1.在grub選項菜單中選擇solaris failasfe項目

2.系統提示Do you wish to have it mounted read-write on /a ?[y,n,?] 選擇y

3.就進入單用戶模式

4.輸入下列命令:passwd

root@#init 6 (重啟)


(五)NetBsd系統密碼

1.開機:當出現提示符號並開始倒數五秒時,鍵入以下指令:

> boot -s(進入單用戶模式命令)

2.在以下的提示符號中

Enter pathname of shell or RETURN for sh:

按下 Enter.

3.鍵入以下指令:

# mount -a

# fsck -y

4.使用passwd更改root的密碼。

5.使用 exit 指令進入多人模式。


(六)SUSE系統密碼

1.重新啟動機器,在出現的grub引導界面後,在啟動的Linux的選項裡加上INIT = /斌/慶典,通過給內核傳遞的init = /斌/慶典參數使得OS在運行的登錄程序之前運行的bash,出現命令行。

2.稍等片刻出現(none)#:命令行。

3.這時輸入mount -n / -o remount,rw表示將根文件系統重新mount為可讀寫,有讀取權限後就可以通過passwd命令修改密碼了。

4.這時輸入passwd的命令就可以重置密碼了

5.修改完成後記得用mount -n / -o remount,ro將根文件系統置為原來的狀態

2018年4月16日 星期一

Redhat & CentOS Setting Display Manager Default:

How to set the default display manager and configure it for remote XDMCP desktop display.

Display Manager Default:

The default display manager for Red Had based systems can be set in /etc/sysconfig/desktop 
Desktop choices: GNOME, KDE 
Display Manager choices: GNOME, XDM, KDE
Example /etc/sysconfig/desktop
DESKTOP="GNOME"
DISPLAYMANAGER="GNOME"
Specifying GNOME as a display manager will invoke GDM.
Upon boot, the system will run /etc/init/prefdm.conf which will in turn call the "Preferred Display Manager" (prefdm) script /etc/X11/prefdmwhich will utilize the settings in /etc/sysconfig/desktop if available.

2018年4月8日 星期日

Out of memory exception in PowerShell


以 "2" 引數呼叫 "Connect" 時發生例外狀況: "已發生類型 'System.OutOfMemoryException' 的例外狀況。"
位於 C:\PS1\010.ps1:27 字元:19
+ $UDPclient.Connect <<<< (([System.Net.IPAddress]::Broadcast),4000)
   + CategoryInfo          : NotSpecified: (:) [], MethodInvocationException
   + FullyQualifiedErrorId : DotNetMethodException
以 "2" 引數呼叫 "Send" 時發生例外狀況: "作業不能用於未連接的通訊端。"
位於 C:\PS1\010.ps1:28 字元:16
已發生類型 'System.OutOfMemoryException' 的例外狀況。
   + CategoryInfo          : NotSpecified: (:) [out-lineoutput], OutOfMemoryException
   + FullyQualifiedErrorId : System.OutOfMemoryException,Microsoft.PowerShell.Commands.OutLineOutputCommand


Get-Item WSMan:\localhost\Shell\MaxMemoryPerShellMB







Set-Item WSMan:\localhost\Shell\MaxMemoryPerShellMB 2048

2018年3月27日 星期二

C# Sample

1.Use Environment.TickCount property. 
[code]
function Delay(int ms)
{
int time = Environment.TickCount;
do while(true)
if(Environment.TickCount - time >= ms) return;
}
[/code]

2.it calculats the Time Laspe From the System Clock
[code]
public static DateTime PauseForMilliSeconds( int MilliSecondsToPauseFor )
{
System.DateTime ThisMoment = System.DateTime.Now ;
System.TimeSpan duration = new System.TimeSpan( 0, 0, 0, 0, MilliSecondsToPauseFor ) ;
System.DateTime AfterWards = ThisMoment.Add( duration ) ;

while ( AfterWards >= ThisMoment )
   {
    System.Windows.Forms.Application.DoEvents() ;
    ThisMoment = System.DateTime.Now ;
   }
return System.DateTime.Now ;
}
[/code]

2018年3月20日 星期二

Linux How do I install .run files?

Terminal Method
Assume the file is called some-app.run and is in the folder /home/user/Downloads. You will need to modify these instructions to fit your situation.
  1. Open a terminal (Applications->Accessories->Terminal).
  2. enter cd /home/user/Downloads
  3. enter chmod +x some-app.run
  4. enter ./some-app.run
  5. if step 4 fails with a message including 'permission denied', try entering sudo ./some-app.run(you will need to enter your password for this).

Q:slow boot time ubuntu - A start job is running for Raise network interfaces

ubuntu16.04.02_x64
editing the file:

sudo vim /etc/systemd/system/network-online.targets.wants/networking.service
And changing the following line at the end of the file:

TimeoutStartSec=5min
to:
TimeoutStartSec=10sec

I have then rebooted the system and it works fine.

If you dont want to reboot the system again, just reboot the daemon by:

2018年3月18日 星期日

Gigabyte disable CSM option

“CSM Support
Enables or disables UEFI CSM (Compatibility Support Module) to support a legacy PC boot process. Always Enables UEFI CSM. (Default)
Never Disables UEFI CSM and supports UEFI BIOS boot process only.

This item is configurable only when Windows 8 Features is set to Windows 8.”

option nerver