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
| #!/usr/bin/env python3 | |
| import sys | |
| def convert_to_bin(): | |
| if len(sys.argv) < 3: | |
| print("Использование: ./bins.py <кол-во_байт> <число>") | |
| print("Пример: ./bins.py 1 255") | |
| return | |
| try: |
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 <stdint.h> | |
| #include <string.h> | |
| #include <stdbool.h> | |
| #define DEBUG | |
| #ifdef DEBUG | |
| #define DEBUG_MODE 1 |
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 <math.h> | |
| #include <stdio.h> | |
| #include <stdlib.h> | |
| #include <unistd.h> | |
| #include <signal.h> | |
| #include <time.h> | |
| #define TIMERS_NUM 10 |
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
| PROG := awesome-prog | |
| SOURCES := $(wildcard *.c) | |
| OBJECTS := $(patsubst %c,%o,$(SOURCES)) | |
| DEPFILES := $(patsubst %.c,%.d,$(SOURCES)) | |
| $(PROG): $(OBJECTS) | |
| $(CC) $(LDFLAGS) -o $@ $^ | |
| %.o: %.d |
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 <stdbool.h> | |
| #define SUCC 0 | |
| #define FULL -1 | |
| #define EMPT -2 | |
| #define FAIL -3 |
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
| for (tot = 0; tot < file_size; tot += c) { | |
| c = read(fd, buf + tot, file_size - tot); | |
| if (c == -1 || c == 0) { | |
| if (tot != in_size) { | |
| fprintf(stderr, "could not read the entire input file\n"); | |
| fprintf(stderr, "file: %s\n", file_name); | |
| goto ERROR; | |
| } | |
| } | |
| } |
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> | |
| int main(void) | |
| { | |
| char a[24], b[24], i; | |
| for (i = 0; i < 24; i++) | |
| a[i] = i; | |
| for (i = 0; i < 24 / sizeof(int); i++) | |
| *((int *)b + i) = *((int *)a + i); | |
| for (i = 0; i < 24; i++) | |
| printf("%c\n", b[i] + 'a'); |
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> | |
| int main(void) | |
| { | |
| printf("char: %zu,short: %zu, int: %zu, void* %zu\n" | |
| "long: %zu, long long: %zu\n" | |
| "float: %zu, double %zu, long double %zu\n", | |
| sizeof(char), sizeof(short), sizeof(int), sizeof(void*), | |
| sizeof(long), sizeof(long long), | |
| sizeof(float), sizeof(double), sizeof(long double)); | |
| return 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
| #!/bin/bash | |
| #https://gist.github.com/ivanria/10b4f1bd7aa79d28de26 | |
| declare -a ARRAY | |
| declare -r TRUE=0 #standard for shell return codes | |
| declare -r FALSE=1 | |
| parse_cmd() { | |
| if [[ "$1" == "" ]] ; then | |
| echo "need number" | |
| exit 1 |