Skip to content

Instantly share code, notes, and snippets.

View clickCA's full-sized avatar
:dependabot:
computing

Chanakorn Aramsak clickCA

:dependabot:
computing
View GitHub Profile
@clickCA
clickCA / test.c
Last active February 20, 2023 16:37
#include <stdio.h>
#include <stdlib.h>
#include <omp.h>
#include <time.h>
int main(void)
{
int a[100000];
double start_time, end_time;
size_t i;
#include <stdio.h>
#include <stdlib.h>
#include <stdint.h>
#define FRAME_SIZE 256
#define FRAME_ENTRIES 128
#define PAGE_SIZE 256
#define PAGE_ENTRIES 16
#define OUTER_PAGE_ENTRIES 16
// A program to simulates page faults and calculates page fault rate.
// Input: a list of page references (a series of page numbers, separated by a space).
// Output: page fault rate
// Option: -v --> verbose mode: print the result of every page reference,
// whether a page fault occurs, the involved page table entry, page number, and frame number.
#include <stdio.h>
#include <stdlib.h>
#include <stdint.h>
#include <string.h>

To run the command:

  1. Change directory to the folder that contains the input file sort-rand-199999999.txt: cd /path/to/folder
  2. Optionally, replace sort-rand-199999999.txt with another input file. Make sure that the file is located in the current directory.
  3. Run the command: time docker run -v $PWD:/input -v $PWD:/output clickads/terasort:latest ./prog /input/sort-rand-199999999.txt /output/out.txt

This command runs a Docker container that uses the clickads/terasort image and sorts the specified input file from the /input directory to the /output/out.txt file. The time command is used to measure the execution time of the command.

To run the command:

  1. Change directory to the folder that contains the input file grid-6-7.txt: cd /path/to/folder
  2. Optionally, replace grid-6-7.txt with another input file. Make sure that the file is located in the current directory.
  3. Run the command: time docker run -v $PWD:/input -v $PWD:/output clickads/powergrid:latest ./prog /input/grid-6-7 /output/out.txt

This command runs a Docker container that uses the clickads/powergrid image and sorts the specified input file from the /input directory to the /output/out.txt file. The time command is used to measure the execution time of the command.

Model Example

// Task.cs (Model)
public class Task
{
    public int Id { get; set; }
    public string Title { get; set; }
    public string Description { get; set; }
}
import hashlib
import itertools
def generate_variants(word):
substitutions = {
'o': '0',
'l': '1',
'i': '1'
}
import hashlib
import itertools
import time
import sys
import os
# Function to generate substituted variants of a word
def generate_variants(word):
substitutions = {
'o': '0',
<!DOCTYPE html>
<html>
<head>
<title>Sign Up Form</title>
<style>
body {
font-family: sans-serif;
text-align: center;
}
{
"status": "OK",
"data": [
{
"YID": 8,
"YEAR": "2022",
"SEMESTERS": [
{
"SEMID": 10,
"CLASSES": [