Skip to content

Instantly share code, notes, and snippets.

View AmirHosein-Gharaati's full-sized avatar
😀
Laughing

Amirhosein Gharaati AmirHosein-Gharaati

😀
Laughing
  • Shiraz University
  • Shiraz, Fars, Iran
View GitHub Profile
@AmirHosein-Gharaati
AmirHosein-Gharaati / c-code-style.md
Last active April 16, 2022 19:51
Recommended C style and coding rules
#include <stdio.h>
#include <stdlib.h>
#include <time.h>
struct Point {
char index;
int x, y;
};
#include <stdio.h>
#include <stdlib.h>
typedef struct node {
int value;
struct node *next;
} Node;
Node *make_node(int value, Node *next){
#include <stdio.h>
#include <stdlib.h>
#include <time.h>
typedef struct node {
int value;
struct node *left;
struct node *right;
struct node *parent;
} Node;
#include <stdio.h>
#include <stdlib.h>
#define COEFFIECIENT 2
typedef struct {
int capacity, used_size;
int *data;
} Vector;
#include<stdio.h>
#include<stdlib.h>
#define maxn 15
int n, m, k;
char G[maxn][maxn];
int fire[maxn][maxn] ;
struct point {

tmux shortcuts & cheatsheet

start new:

tmux

start new with session name:

tmux new -s myname
#include <stdio.h>
#include <stdlib.h>
#define MAX 1000000
char* get_str();
void sort(char**, int);
int main() {
// input: amirhosein amir alireza mohsen mohammad

Downloader Application

We are going to implement a simple downloader.

In this applcation, we can download multiple resources at the same time. But with a limitation.

The limitation is that we can download at most N files simultaneously. For example, if N is equal to 3, we can download 3 files at the same time. Then, when one of the threads has completed downloading a file, another thread will start its process.

Phase 1