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 <ncurses.h> | |
| int main() | |
| { | |
| initscr(); | |
| keypad(stdscr, true); //Включаем режим чтения функциональных клавиш | |
| noecho(); //Выключаем отображение вводимых символов, нужно для getch() | |
| halfdelay(100); //Устанавливаем ограничение по времени ожидания getch() в 10 сек | |
| printw("Press F2 to exit.\n"); |
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 <string.h> | |
| #define DO_ACTIVE 1 << 0 | |
| #define DO_IDLE 1 << 1 | |
| #define DO_IDLE_IN_XACT 1 << 2 | |
| #define DO_WAITING 1 << 3 | |
| #define DO_OTHER 1 << 4 | |
| int main(void) |
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
| # add | |
| # avpkt 1500 - MTU, bandwidth 1000mbit - interface speed, rate 20mbit - limit threshold | |
| tc qdisc add dev eth1 root handle 1: cbq avpkt 1500 bandwidth 1000mbit | |
| tc class add dev eth1 parent 1: classid 1:1 cbq rate 20mbit allot 1500 prio 5 bounded isolated | |
| tc filter add dev eth1 parent 1: protocol ip prio 16 u32 match ip dst 10.0.0.33 flowid 1:1 | |
| # remove | |
| tc filter del dev eth1 parent 1: protocol ip prio 16 u32 match ip dst 10.0.0.33 flowid 1:1 | |
| tc class del dev eth1 parent 1: classid 1:1 cbq rate 20mbit allot 1500 prio 5 bounded isolated | |
| tc qdisc del dev eth1 root handle 1: cbq avpkt 1500 bandwidth 1000mbit |
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 <signal.h> | |
| #include <stdlib.h> | |
| #include <unistd.h> | |
| void sig_handler(int signo) | |
| { | |
| if (signo == SIGINT) { | |
| printf("received SIGINT\n"); | |
| exit(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
| /** | |
| ****************************************************| | |
| * String replace Program | | |
| ****************************************************| | |
| * Takes three string input from the user | |
| * Replaces all the occurances of the second string | |
| * with the third string from the first string | |
| * @author Swashata -- http://www.intechgrity.com/c-program-replacing-a-substring-from-a-string/ | |
| */ | |
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
| #define _GNU_SOURCE | |
| #include <stdio.h> | |
| #include <string.h> | |
| #include <sys/types.h> | |
| #include <sys/stat.h> | |
| #include <fcntl.h> | |
| #include <stdlib.h> | |
| #include <unistd.h> | |
| #include <stdint.h> | |
| #define BUFSIZE 8192 |
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
| SELECT n.nspname as "Schema", | |
| c.relname as "Name", | |
| pg_catalog.pg_get_userbyid(c.relowner) as "Owner" FROM pg_catalog.pg_class c | |
| LEFT JOIN pg_catalog.pg_namespace n ON n.oid = c.relnamespace | |
| WHERE c.relkind IN ('r','') AND c.relpersistence = 't' | |
| ORDER BY 1,2; |
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 <string.h> | |
| int main(void) | |
| { | |
| FILE *fp; | |
| fp = fopen("/proc/meminfo", "r"); | |
| char buffer[121]; | |
| char key[80]; | |
| long int value; |
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 <sys/types.h> | |
| #include <sys/wait.h> | |
| #include <stdlib.h> | |
| #include <unistd.h> | |
| #include "libpq-fe.h" | |
| /* gcc -std=gnu99 -pedantic -I/usr/pgsql-9.4/include -L/usr/pgsql-9.4/lib -o broken-conns broken-conns.c -lpq */ | |
| #define CONNINFO "host = 127.0.0.1 port = 5433 dbname = hldemo user = postgres" |
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 <string.h> | |
| #include <stdbool.h> | |
| #include <unistd.h> | |
| #include <errno.h> | |
| #include <ncurse |