Skip to content

Instantly share code, notes, and snippets.

@x-yuri
x-yuri / TCP echo TLS client|server.md
Last active May 14, 2024 12:29
TCP echo TLS client/server

TCP echo TLS client/server

#include <stdio.h>
#include <stdlib.h>
#include <sys/socket.h>
#include <arpa/inet.h>
#include <netinet/in.h>
#include <unistd.h>
#include <openssl/ssl.h>
@x-yuri
x-yuri / gcc: the order of -l options.md
Last active May 11, 2024 13:29
gcc: the order of -l options

gcc: the order of -l options

a.c:

#include <openssl/ssl.h>
int main(int argc, char **argv) {
    SSL_CTX *ssl_server_ctx = SSL_CTX_new(TLS_server_method());
    return ssl_server_ctx ? EXIT_SUCCESS : EXIT_FAILURE;
}
@x-yuri
x-yuri / TCP echo client|server.md
Last active May 14, 2024 12:30
TCP echo client/server

TCP echo client/server

#include <stdio.h>
#include <stdlib.h>
#include <sys/socket.h>
#include <arpa/inet.h>
#include <netinet/in.h>
#include <unistd.h>
#include <string.h>
@x-yuri
x-yuri / redis + hitch.md
Last active May 9, 2024 05:05
redis + hitch

redis + hitch

main.tf:

provider "google" {
  project = "PROJECT_ID"
}

resource "google_compute_instance" "test-redis" {
@x-yuri
x-yuri / redis + spiped.md
Last active May 9, 2024 02:20
redis + spiped

redis + spiped

main.tf:

provider "google" {
  project = "PROJECT_ID"
}

resource "google_compute_instance" "test-redis" {
@x-yuri
x-yuri / redis + stunnel (SSL + verify).md
Last active May 7, 2024 15:43
redis + stunnel (SSL + verify)

redis + stunnel (SSL + verify)

main.tf:

provider "google" {
  project = "PROJECT_ID"
}

resource "google_compute_instance" "test-redis" {
@x-yuri
x-yuri / redis + stunnel (SSL + verify).md
Last active May 9, 2024 02:45
redis + stunnel (SSL + verify)

redis + stunnel (SSL + verify)

main.tf:

provider "google" {
  project = "PROJECT_ID"
}

resource "google_compute_instance" "test-redis" {
@x-yuri
x-yuri / redis + stunnel (SSL).md
Last active May 9, 2024 02:43
redis + stunnel (SSL)

redis + stunnel (SSL)

main.tf:

provider "google" {
  project = "PROJECT_ID"
}

resource "google_compute_instance" "test-redis" {
@x-yuri
x-yuri / redis upgrade.md
Created May 4, 2024 16:01
redis upgrade

redis upgrade

$ curl -sS https://raw.githubusercontent.com/redis/redis/5.0/redis.conf -o redis5.conf
$ curl -sS https://raw.githubusercontent.com/redis/redis/7.2/redis.conf -o redis7.conf

$ docker run --rm -it \
  -v "$PWD/redis5.conf:/etc/redis.conf" \
  -v redis:/data \
  redis:5.0.14-alpine3.16 redis-server /etc/redis.conf
@x-yuri
x-yuri / redis replication.md
Created May 4, 2024 15:44
redis replication

redis replication

docker-compose.yml:

services:
  master:
    image: redis:5.0.14-alpine3.16
    command: redis-server /etc/redis.conf
    volumes: