Windows: Difference between revisions

From 太極
Jump to navigation Jump to search
No edit summary
Line 1: Line 1:
== Install ubuntu on my 64GB USB drive ==
http://www.pendrivelinux.com/universal-usb-installer-easy-as-1-2-3/
<pre>
$ df -h
Filesystem Size  Mounted on
/cow      3.9G  /
udev      3.9G  /dev
tmpfs      1.6G  /run
/dev/sdb1  61G    /cdrom
/dev/loop0 672M  /rofs
tmpfs      3.9G  /tmp
none      5.0M  /run lock
none      3.9G  /run/shm
</pre>
== Internet connection sharing (ICS) ==
== Internet connection sharing (ICS) ==
Suppose a laptop can connect to the internt through wireless. We want to use its ethernet port to share internet on another device (e.g. raspberry pi where the device has only ethernet port).
Suppose a laptop can connect to the internt through wireless. We want to use its ethernet port to share internet on another device (e.g. raspberry pi where the device has only ethernet port).

Revision as of 12:09, 22 February 2013

Install ubuntu on my 64GB USB drive

http://www.pendrivelinux.com/universal-usb-installer-easy-as-1-2-3/

$ df -h
Filesystem Size   Mounted on
/cow       3.9G   /
udev       3.9G   /dev
tmpfs      1.6G   /run
/dev/sdb1  61G    /cdrom
/dev/loop0 672M   /rofs
tmpfs      3.9G   /tmp
none       5.0M   /run lock
none       3.9G   /run/shm

Internet connection sharing (ICS)

Suppose a laptop can connect to the internt through wireless. We want to use its ethernet port to share internet on another device (e.g. raspberry pi where the device has only ethernet port).

  1. control panel - network & sharing center
  2. manage network connection
  3. right click wireless network connection and select property
  4. click 'sharing' tab and check 'Allow other network users to connect through this computer's internet connection'. For the home network connection, select 'Local Area Connection'.
  5. reboot raspberry pi.

When my host machine is xubuntu, the guest machine (raspberry pi) shows eth0 has ip 10.42.0.37 and the host machine shows

xubuntu@xubuntu:~$ ifconfig
eth0      Link encap:Ethernet  HWaddr 00:22:19:ea:10:3d  
          inet addr:10.42.0.1  Bcast:10.42.0.255  Mask:255.255.255.0
          inet6 addr: fe80::222:19ff:feea:103d/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:284 errors:0 dropped:0 overruns:0 frame:0
          TX packets:383 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000 
          RX bytes:19038 (19.0 KB)  TX bytes:85493 (85.4 KB)
          Interrupt:43 Base address:0x2000 

lo        Link encap:Local Loopback  
          inet addr:127.0.0.1  Mask:255.0.0.0
          inet6 addr: ::1/128 Scope:Host
          UP LOOPBACK RUNNING  MTU:16436  Metric:1
          RX packets:972 errors:0 dropped:0 overruns:0 frame:0
          TX packets:972 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0 
          RX bytes:90336 (90.3 KB)  TX bytes:90336 (90.3 KB)

wlan0     Link encap:Ethernet  HWaddr 00:17:c4:62:a0:35  
          inet addr:192.168.1.153  Bcast:192.168.1.255  Mask:255.255.255.0
          inet6 addr: 2601:a:3780:6a:217:c4ff:fe62:a035/64 Scope:Global
          inet6 addr: fe80::217:c4ff:fe62:a035/64 Scope:Link
          inet6 addr: 2601:a:3780:6a:a4b9:d314:4790:a0a1/64 Scope:Global
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:6300 errors:0 dropped:0 overruns:0 frame:0
          TX packets:4812 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000 
          RX bytes:6042745 (6.0 MB)  TX bytes:659980 (659.9 KB)

xubuntu@xubuntu:~$ 

Access cloud storage

Windows Power Shell

Windows 8

Keyboard shortcut.

  • Ctrl+C: charm bar
  • Ctrl+w: search

Securely transfer files to Linux on Windows command line

putty

Use psftp or pscp with a script.

Use winscp with script or in command line

See http://winscp.net/eng/docs/feature_index

C:\Program Files\WinSCP\winscp.exe" /console /script=YOUR_SCRIPT_FILENAME 

Example from http://winscp.net/eng/docs/scripting#example

# Automatically abort script on errors
option batch abort
# Disable overwrite confirmations that conflict with the previous
option confirm off
# Connect using a password
# open sftp://user:[email protected] 
# Connect
open sftp://[email protected] 
# Change remote directory
cd /home/user
# Force binary mode transfer
option transfer binary
# Download file to the local directory d:\
get examplefile.txt d:\
# Disconnect
close
# Connect as a different user
open [email protected]
# Change the remote directory
cd /home/user2
# Upload the file to current working directory
put d:\examplefile.txt 
# Disconnect
close
# Exit WinSCP
exit

See http://wiki.vpslink.com/Automate_Backup_Retrieval_with_WinSCP#Test_WinSCP_Backup_Script for use winscp with Windows scheduler.

Putty with tabs

Find public IP address

Create a VB script text file "ip.cbs" with a content like

Option Explicit
Dim http : Set http = CreateObject( "MSXML2.ServerXmlHttp" )
http.Open "GET", "http://icanhazip.com", False
http.Send
Wscript.Echo http.responseText   'or do whatever you want with it
Set http = Nothing

Open a command line and run

cscript ip.vbs

The output will look like

C:\Users\mli>cscript ip.vbs
Microsoft (R) Windows Script Host Version 5.7
Copyright (C) Microsoft Corporation. All rights reserved.

2601:a:3780:5b:b856:6a09:3ea3:5e26
  • On windows, open a command prompt. Type 'ipconfig' and look at IPv4 Address. But 'ipconfig' cannot show only one adapter. Another choice is netsh
x <- shell('netsh interface ip show addresses "Local Area Connection"', intern = T)
y <- strsplit(x[grep("IP Address", x)], " ")[[1]]
y[length(y)]
# [1] "xxx.xx.xx.xxx"

Notepad++

How to increase font size? Just hold Ctrl and use scroll wheel. See here. It even save the status when you restart Notepad++.

And for convenience, we can change the default language to R in Notepad++'s Settings.

Visual Studio 2010

  1. Create simple form using VS C++ http://www.youtube.com/watch?v=L8E4C0zbIHA