Skip to content

Instantly share code, notes, and snippets.

View aabdelfattah's full-sized avatar

Ahmed Abdelfattah aabdelfattah

View GitHub Profile
@aabdelfattah
aabdelfattah / qemu-macos
Last active March 29, 2023 11:21
Run yocto qemux86-64 image with HVF acceleration and SSH access on MacOS
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
@aabdelfattah
aabdelfattah / Rust Linux kernel development Environment
Last active January 18, 2023 20:32
Setting up an environment for Rust Linux kernel development
#
# 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
@aabdelfattah
aabdelfattah / move.cpp
Created June 4, 2019 16:30
move constructor
class Obj {
...
//move constructor
Obj(const Obj&& other){
..
}
//move assignment operator
Obj& operator= (const Obj&& other){
..
}
@aabdelfattah
aabdelfattah / copy.cpp
Created June 4, 2019 16:19
copy constructor
class Obj {
//default constructor
Obj(int size){
..
}
//copy constructor
Obj(const Obj& other){
..
}
//assignment operator
@aabdelfattah
aabdelfattah / rvalue.cpp
Created June 4, 2019 12:46
returning rvalue
string getName() {
string str = "medium";
return s;
}
// getName() returns an rvalue
string&& name = getName();
@aabdelfattah
aabdelfattah / assignment.cpp
Created June 4, 2019 12:41
variable assignment
string str = "medium";
@aabdelfattah
aabdelfattah / call-by-ref.py
Last active June 4, 2019 11:41
python pass object reference by value
def modify(arg):
arg += [1]
l = [2]
modify(l)
print(l) # >> [2, 1]
@aabdelfattah
aabdelfattah / call-by-value.py
Last active June 4, 2019 11:41
python pass object reference by value
def modify(arg):
arg = 'hard'
str = 'medium'
modify(str)
print(str) # >> medium
@aabdelfattah
aabdelfattah / assignment.py
Last active June 4, 2019 12:43
object assignment
str = 'medium'