View qemu-macos
This file contains 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
qemu-system-x86_64 \ | |
-kernel bzImage--5.15.96+git0+509f4b9d68_001e2930e6-r0-qemux86-64-20230327112333.bin \ | |
-enable-kvm \ | |
-machine q35,accel=hvf \ | |
-device virtio-net-pci,netdev=net0 \ | |
-netdev user,id=net0,hostfwd=tcp::5555-:22,net=192.168.7.0/24,host=192.168.7.1,dhcpstart=192.168.7.2 \ | |
-drive file=core-image-minimal-qemux86-64-20230327162556.rootfs.ext4,if=virtio,format=raw \ | |
-append "root=/dev/vda console=ttyS0 ip=dhcp" \ | |
-serial stdio \ | |
-m 2048M |
View Rust Linux kernel development Environment
This file contains 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
# | |
# Instructions for the video https://www.youtube.com/watch?v=tPs1uRqOnlk excluding setting up the env ( e.g. installing Rust and llvm) | |
# | |
# | |
# Kernel | |
# | |
$ git clone --depth=1 https://github.com/Rust-for-Linux/linux.git |
View move.cpp
This file contains 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
class Obj { | |
... | |
//move constructor | |
Obj(const Obj&& other){ | |
.. | |
} | |
//move assignment operator | |
Obj& operator= (const Obj&& other){ | |
.. | |
} |
View copy.cpp
This file contains 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
class Obj { | |
//default constructor | |
Obj(int size){ | |
.. | |
} | |
//copy constructor | |
Obj(const Obj& other){ | |
.. | |
} | |
//assignment operator |
View rvalue.cpp
This file contains 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
string getName() { | |
string str = "medium"; | |
return s; | |
} | |
// getName() returns an rvalue | |
string&& name = getName(); |
View assignment.cpp
This file contains 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
string str = "medium"; |
View call-by-ref.py
This file contains 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
def modify(arg): | |
arg += [1] | |
l = [2] | |
modify(l) | |
print(l) # >> [2, 1] |
View call-by-value.py
This file contains 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
def modify(arg): | |
arg = 'hard' | |
str = 'medium' | |
modify(str) | |
print(str) # >> medium |
View assignment.py
This file contains 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
str = 'medium' |