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
<template> | |
<span class="text-h3">Just title</span> | |
</template> |
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
import { | |
FirebaseFirestore, | |
DocumentReference, | |
CollectionReference, | |
GeoPoint, | |
} from "@firebase/firestore-types"; | |
const stateData = [ | |
{ name: "Alaska", abbrev: "AK", capital: "Juneau", population: 735_720 }, | |
{ |
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
#include <stdio.h> | |
#include <stdlib.h> | |
#include <errno.h> | |
const size_t GIGA = 1024*1024*1024; | |
int main() { | |
for (int k = 1; k <= 128; k++) { | |
char *p = malloc(k * GIGA); | |
if (p == NULL || errno != 0) { |
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
#include <stdio.h> | |
#include <stdlib.h> | |
#include <unistd.h> | |
#include <fcntl.h> | |
#include <sys/wait.h> | |
#include <sys/mman.h> | |
typedef struct { | |
int arr[2]; | |
} shared_info; |
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
#include <stdio.h> | |
#include <stdlib.h> | |
#include <pthread.h> | |
void* swapper(void*); | |
int arr[2]; | |
int main(int argc, char* argv[]) { | |
pthread_t who; |
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
#include <fcntl.h> | |
#include <unistd.h> | |
#include <stdbool.h> | |
#include <stdio.h> | |
#include <string.h> | |
#include <sys/mman.h> | |
#include <sys/types.h> | |
#include <time.h> | |
// New type definitions |
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
/* | |
* Demonstrate a minimal code to implement thread switching in user | |
* space | |
**/ | |
#include <ucontext.h> | |
#include <stdio.h> | |
#include <unistd.h> | |
#include <signal.h> | |
#include <sys/time.h> |
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
#include <signal.h> | |
#include <stdio.h> | |
#include <unistd.h> | |
#include <stdbool.h> | |
#include <sys/types.h> | |
#include <sys/wait.h> | |
bool running = true; | |
void sigHandler(int number) { |
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
use core::ffi::c_void; // FFI: Foreign Function Interface | |
use libc::{c_int, shmid_ds}; | |
use libc::{shmat, shmctl, shmdt, shmget}; | |
use libc::{IPC_PRIVATE, IPC_RMID, S_IRUSR, S_IWUSR}; | |
const FOO: usize = 4096; | |
fn main() { | |
println!("Hello, world!"); | |
let shm_ptr: *mut c_void; |
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
use nix::unistd::sleep; | |
use std::thread; | |
// Global variable | |
static mut SHARED_DATA: u8 = 5; | |
fn main() { | |
// Use lambda when the thread function takes arguments | |
let thr1 = thread::spawn(|| do_greeting3('a')); | |
let thr2 = thread::spawn(|| do_greeting3('b')); |