Skip to content

Instantly share code, notes, and snippets.

View ssrlive's full-sized avatar

ssrlive

  • telegram: realssrlive
  • ssrlivebox(at)gmail(dot)com
View GitHub Profile
@ssrlive
ssrlive / libuv_tls.c
Created June 19, 2019 08:25
libuv + openssl
//#include "stdafx.h"
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <openssl/ssl.h>
#include <openssl/err.h>
#include <uv.h>
//
// https://dzone.com/articles/using-openssl-with-libuv
#include <stdio.h>
#include <stdint.h>
#include <pthread.h>
#include <uv.h>
/* Libuv multiple loops + thread communication example. */
//rpath is needed because it is an argument to the linker (not compiler) about
//where to look
//gcc -Iinclude -g multi-uv-loops.c -o multi-uv-loops -L "./" -l uv -Xlinker -rpath -Xlinker "./" -lrt
@ssrlive
ssrlive / multi-uv-loops.c
Created July 15, 2019 08:40
multiple loops in libuv
#include <stdio.h>
#include <stdint.h>
#include <pthread.h>
#include <uv.h>
/* Libuv multiple loops + thread communication example. */
//rpath is needed because it is an argument to the linker (not compiler) about
//where to look
//gcc -Iinclude -g multi-uv-loops.c -o multi-uv-loops -L "./" -l uv -Xlinker -rpath -Xlinker "./" -lrt
@ssrlive
ssrlive / udp-svr.py
Created December 21, 2019 13:26
udp-svr.py
#!/usr/bin/env python2
# -*- coding: utf-8 -*-
# This script will always echo back data on the UDP port of your choice.
# Useful if you want nmap to report a UDP port as "open" instead of "open|filtered" on a standard scan.
# Works with both Python 2 & 3.
import socket
sock = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
@ssrlive
ssrlive / udp-cli.py
Last active February 23, 2022 13:57
udp-cli.py
#!/usr/bin/python
'''
python UDP echo client by ccc <yyy@gmail>
USAGE: %s <server_ip> <server_port> <message>
'''
import socket
import time
from sys import argv
#include <stdio.h>
#include <stdlib.h>
// http://journal.stuffwithstuff.com/2013/12/08/babys-first-garbage-collector/
#define GC_STACK_MAX 256
enum gc_object_type {
GC_OBJ_INT,
GC_OBJ_PAIR,
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <unistd.h>
#include <fcntl.h>
#include <sys/types.h>
#if defined(WIN32) || defined(_WIN32)
#include <winsock2.h>
#include <ws2tcpip.h>
#include <windows.h>
@ssrlive
ssrlive / lets-encrypt-for-windows.md
Last active January 10, 2025 14:31
Let's Encrypt, Nginx, Windows

Before the following steps, please create folder c:/nginx/html/.well-known first with mkdir c:\nginx\html\.well-known.

C:\nginx>C:\win-acme\wacs.exe
 Error creating event logger: The source was not found, but some or all event logs could not be searched.  Inaccessible logs: Security.

 A simple Windows ACMEv2 client (WACS)
 Software version 2.1.6.773 (RELEASE, PLUGGABLE)
 ACME server https://acme-v02.api.letsencrypt.org/
 IIS not detected
@ssrlive
ssrlive / callstack.c
Created June 19, 2020 14:08
call stack dump
#include <string.h>
#include <stdio.h>
#include "callstack.h"
#define FUNC_COUNT 100
#define FUNC_NAME_LEN_MAX 256
static char func_name_array[FUNC_COUNT][FUNC_NAME_LEN_MAX] = { { 0 } };
void call_stack_push_func_name(const char *func_name) {
@ssrlive
ssrlive / rust.md
Created June 29, 2020 23:31
Rust installing on Linux
apt-get update -y && apt-get dist-upgrade -y &&  apt-get install build-essential -y

curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh

rustup toolchain remove nightly
rustup default nightly
rustup target add x86_64-unknown-linux-musl

source $HOME/.cargo/env