mirror of
https://github.com/chubin/cheat.sheets
synced 2024-11-15 06:12:59 +00:00
Merge pull request #141 from terminalforlife/master
Line Length Fixes & New Sheet Stuff
This commit is contained in:
commit
b397565ed2
@ -78,7 +78,8 @@ countTo(3) = Range(1,2,3)
|
||||
countTo() = Range(1,2,3,4,5)
|
||||
|
||||
// higher order functions
|
||||
// as long as a function returns the correct type, it can be used as a parameter in another function
|
||||
// as long as a function returns the correct type, it can be used as a
|
||||
// parameter in another function
|
||||
def sum(a: Int, b: Int): Int = a + b
|
||||
def double(x: Int): Int = x * 2
|
||||
double(sum(1, 1)) // returns 4
|
||||
|
7
sheets/mount
Normal file
7
sheets/mount
Normal file
@ -0,0 +1,7 @@
|
||||
# mount
|
||||
# Mount a filesystem
|
||||
|
||||
# Mount a temporary filesystem (TMPFS) of 4GB to '/mnt'. The contents will
|
||||
# vanish when you reboot, but this can be very useful when working with things
|
||||
# like bootstrap tarballs or temporary storages for sensitive data.
|
||||
mount -t tmpfs -o mode=755,size=4096M tmpfs /mnt
|
@ -58,3 +58,11 @@ perl -e 'print("$<:" . (split(" ", $)))[0] . "\n")'
|
||||
# You might spot some printable strings, such as 'LILO' or 'GRUB', if you've
|
||||
# also stored your bootloader on the MBR of the storage device (non-UEFI).
|
||||
perl -e 'open(my $FH, "</dev/sda"); read($FH, my $Data, 512); close($FH); print("$Data\n")'
|
||||
|
||||
# Create a simple table of users within your system. This example demonstrates
|
||||
# the use of the `getpwent()` subroutine, which, upon each execution, holds an
|
||||
# array of each field in each line within the '/etc/passwd' file.
|
||||
printf("%-15s %-5s %-5s %-s\n", 'USERNAME', 'UID', 'GID', 'HOME');
|
||||
while (my @Data = getpwent()) {
|
||||
printf("%-15s %-5s %-5s %-s\n", $Data[0], $Data[2], $Data[3], $Data[7])
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user