This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/usr/bin/env python | |
| from __future__ import print_function | |
| from __future__ import division | |
| from subprocess import Popen, PIPE | |
| def ioreg_battery_info(): | |
| output = Popen(["ioreg", "-r", "-k", "LegacyBatteryInfo", "-w", "0"], stdout=PIPE).communicate()[0] | |
| try: #python3 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #### Array #### | |
| # create data vector | |
| data1 <- c(187,321,431,211) | |
| data2 <- c(100,587,498,967,3567,4030,3888,3021,8765,9999,7867,8799) | |
| data3 <- seq(4560, 7650, length.out = 16) # seq for generate sequence of number | |
| data4 <- ceiling(seq(14640, 25600, length.out = 16)) #ceiling for roundup number | |
| myarray <- array(c(data1,data2, data3, data4), | |
| dim = c(4,4,3), |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #### Create Function #### | |
| # first approch | |
| fn1 <- function (myinput) { myinput * 999 } | |
| # how to use it | |
| fn1(E) | |
| fn1(myinput = E) | |