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 <curl/curl.h> | |
#include <stdio.h> | |
int main(void) | |
{ | |
/* Initialize request with curl */ | |
CURL *req = curl_easy_init(); | |
if (!req) { | |
fprintf(stderr, "Error: curl initialization failed"); |
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> | |
/* | |
* In the expression `&ptr[5]` which is equivalent to `&(*(ptr + 5))`, we take | |
* the address of the fifth element which means an offset in bytes equal to `5 * | |
* sizeof(*ptr)` from the `ptr` base address. The address is simply retrieved as | |
* `ptr + 5` by the compiler and no memory access (i.e. dereferencing) is | |
* usually involved here. | |
* | |
* For a structure, the variable name represents the whole memory area from the |
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 <arpa/inet.h> | |
#include <errno.h> | |
#include <stdio.h> | |
#include <stdlib.h> | |
#include <string.h> | |
#include <sys/socket.h> | |
#include <sys/types.h> | |
#define REMOTE_ADDR "127.0.0.1" | |
#define REMOTE_PORT 4444 |
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 <arpa/inet.h> | |
#include <errno.h> | |
#include <stdio.h> | |
#include <stdlib.h> | |
#include <string.h> | |
#include <sys/socket.h> | |
#include <sys/types.h> | |
#include <unistd.h> | |
#define REMOTE_ADDR "127.0.0.1" |
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
#!/bin/bash | |
# daemonize a process by closing its file descriptors and detaching the process | |
# from its controlling terminal and the current session group | |
launch_daemon () { | |
$1 < /dev/null > /dev/null 2>&1 0<&- 1>&- 2>&- & | |
disown | |
} | |
# function to get the array key associated with one value |
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 <termios.h> | |
#include <unistd.h> | |
#define MAX_BUFSIZE 4096 | |
int main(int argc, char *argv[]) | |
{ | |
struct termios old_termios; | |
struct termios new_termios; |
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
terraform { | |
required_providers { | |
azurerm = { | |
source = "hashicorp/azurerm" | |
version = "=3.45.0" | |
} | |
} | |
} | |
provider "azurerm" { |
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> | |
#pragma pack(1) | |
struct my_struct | |
{ | |
unsigned char b0; | |
unsigned char b1; | |
unsigned char b2; | |
unsigned char b3; | |
unsigned char b4; |
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
#!/bin/bash | |
# NOTE: replace the root user shell by placing this script at /usr/local/bin/systemd-stub | |
# login user | |
user=ed | |
if [[ -p /dev/stdin ]] || [[ "$BASH_ARGC" -gt 0 ]]; then | |
shell=/bin/bash | |
else |