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
use nix::unistd::{fork, ForkResult}; | |
// use nix::sys::wait::wait; | |
// use nix::sys::wait::WaitStatus; | |
use std::process; | |
fn main() { | |
let pid = fork(); | |
match pid { | |
Ok(ForkResult::Child) => { | |
println!("I'm a child with PID {}", process::id()); |
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
#include <fcntl.h> | |
#include <stdio.h> | |
#include <unistd.h> | |
#include <errno.h> | |
int main() { | |
char name[50]; | |
int fd = open("myoutput.txt", | |
O_WRONLY | O_CREAT | O_EXCL, |
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
#include <stdio.h> | |
#include <stdlib.h> | |
#include <unistd.h> | |
#include <string.h> | |
#define READ 0 | |
#define WRITE 1 | |
#define MAX 1024 | |
int main () { |
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
#include <stdio.h> | |
#include <signal.h> | |
#include <stdlib.h> | |
#include <errno.h> | |
#include <stdbool.h> | |
int number = 0; | |
bool running = true; | |
void do_nothing(int s) { |
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
#include <stdio.h> | |
#include <signal.h> | |
#include <stdlib.h> | |
#include <errno.h> | |
#include <stdbool.h> | |
int number = 0; | |
bool running = true; | |
void do_nothing(int s) { |
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
<template> | |
<span class="text-h3">Just title</span> | |
</template> |
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
import { | |
FirebaseFirestore, | |
DocumentReference, | |
CollectionReference, | |
GeoPoint, | |
} from "@firebase/firestore-types"; | |
const stateData = [ | |
{ name: "Alaska", abbrev: "AK", capital: "Juneau", population: 735_720 }, | |
{ |
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
#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 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 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; |
NewerOlder