Skip to content

Instantly share code, notes, and snippets.

fn main() {
let s = String::from("hello");
takes_ownership(s);
let x = 5;
makes_copy(x);
}
use rand::Rng;
use std::cmp::Ordering;
use std::io;
fn main() {
println!("Guess the number!");
let secret_number = rand::thread_rng().gen_range(1..=100);
println!("The secret number is: {secret_number}");
fn main() {
println!("Hello,world");
}
@hcyang1012
hcyang1012 / rs
Created January 7, 2023 12:23
My first gist code
fn main() {
println!("Hello, world!");
}
@hcyang1012
hcyang1012 / c++
Created November 29, 2022 00:53
Downcast Test
class CPU {
public:
void Work();
private:
};
class Intel : public CPU{
public :
class CPU {
public:
void Work();
private:
};
class Intel : public CPU{
public :
@hcyang1012
hcyang1012 / from boot to platform_bus_init.txt
Last active August 12, 2019 22:30
Linux Kernel : From boot to platform_bus_init()
@startuml
participant "head.S"
participant "init/main.c"
participant "init/main.c (New kernel thread)"
head.S -> "init/main.c": start_kernel()
activate "init/main.c"
"init/main.c" -> "init/main.c": arch_call_rest_init()
activate "init/main.c"
"init/main.c" -> "init/main.c": rest_init();
@hcyang1012
hcyang1012 / am335x-boneblack.dts
Last active April 13, 2019 13:27
Beaglebone Black Device Tree for enable SPI-LCD
/*
* Copyright (C) 2012 Texas Instruments Incorporated - http://www.ti.com/
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation.
*/
/dts-v1/;
#include "am33xx.dtsi"
sudo tar xfvp ./*-*-*-armhf-*/armhf-rootfs-*.tar -C /home/hcyang/work/boot/rootfs/
sync
sudo chown root:root /home/hcyang/work/boot/rootfs/
sudo chmod 755 /home/hcyang/work/boot/rootfs/
sync
sudo mkdir -p /home/hcyang/work/boot/rootfs/boot/
sudo mkdir -p /home/hcyang/work/boot/rootfs/boot/dtbs/${kernel_version}/
sudo mkdir -p rootfs/boot/dtbs/${kernel_version}/
sudo sh -c "echo 'uname_r=${kernel_version}' >> /home/hcyang/work/boot/rootfs/boot/uEnv.txt"
@hcyang1012
hcyang1012 / Beaglebone Black Device Tree Configuration for DCAN1
Last active November 19, 2018 14:10
Beaglebone BlackConfiguration for DCAN1
/* Device Tree */
&dcan1{
#address-cells = <1>;
#size-cells = <0>;
status = "okay";
pinctrl-names = "default";
pinctrl-0 = <&dcan1_pins_s0>;
};