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 <time.h> | |
#include <stdlib.h> | |
int main() | |
{ | |
char input[3]; | |
int input_number; | |
int generated_number; |
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
; | |
; _e820 -> call _do_e820 function from assembly to not get random garbage | |
; Thanks to Nanobyte for help | |
; | |
global _e820 | |
_e820: | |
; make new call frame | |
push bp ; save old call frame | |
mov bp, sp ; initialize new call frame |
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 the INT 0x15, eax= 0xE820 BIOS function to get a memory map | |
; note: initially di is 0, be sure to set it to a value so that the BIOS code will not be overwritten. | |
; The consequence of overwriting the BIOS code will lead to problems like getting stuck in `int 0x15` | |
; inputs: es:di -> destination buffer for 24 byte entries | |
; outputs: bp = entry count, trashes all registers except esi | |
mmap_ent equ 0x8000 ; the number of entries will be stored at 0x8000 | |
global _do_e820 | |
_do_e820: | |
mov di, 0x8004 ; Set di to 0x8004. Otherwise this code will get stuck in `int 0x15` after some entries are fetched | |
xor ebx, ebx ; ebx must be 0 to start |
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 <stdint.h> | |
#include <stddef.h> | |
#include <stdbool.h> | |
#include "limine.h" | |
#include "kernel/kernel.h" | |
// The Limine requests can be placed anywhere, but it is important that | |
// the compiler does not optimise them away, so, usually, they should |
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 { Configuration, OpenAIApi } from "openai"; | |
import { writeFileSync } from "fs"; | |
async function Generate(prompt) { | |
const configuration = new Configuration({ | |
apiKey: "your api key", | |
}); | |
const openai = new OpenAIApi(configuration); | |
const result = await openai.createImage({ |
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
#![allow(unused_must_use)] | |
use clearscreen; | |
use crossterm::{style, QueueableCommand}; | |
use std::io::{stdin, stdout, Stdout, Write}; | |
fn quiz(stdout: &mut Stdout) { | |
let questions: [String; 11] = [ | |
String::from("Što je štednja [A - čuvanje materijalnih dobara od potrošnje u određenoj situaciji; B - neumjerena potrošnja novca; C - skakanje iz zrakoplova s instruktorom]: "), // A |
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 std::time::Instant; | |
use rand::thread_rng; | |
use rand::seq::SliceRandom; | |
fn create_shuffled_numbers(num_prisoners: i64) -> Vec<i64> { | |
let mut a: Vec<i64> = Vec::new(); | |
let mut i = 0; | |
while i < num_prisoners { |
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
/* Just random math problem written in LaTex */ | |
\begin{quote} | |
\huge | |
{ | |
\[\frac | |
{ | |
\frac | |
{ | |
\frac |
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> | |
int main() | |
{ | |
int num; | |
printf("Enter a number: \n"); | |
scanf("%d", &num); | |
if (num >= 0) |
NewerOlder