Skip to content

Instantly share code, notes, and snippets.

@pttsync
pttsync / client.c
Created August 25, 2022 10:55 — forked from Alexey-N-Chernyshov/client.c
Example of client/server with select().
// Simple example of client.
// Client prints received messages to stdout and sends from stdin.
#include <errno.h>
#include <fcntl.h>
#include <stdio.h>
#include <signal.h>
#include <unistd.h>
#include <sys/select.h>
#include <netinet/in.h>
@pttsync
pttsync / dns.c
Created August 25, 2022 10:54 — forked from fffaraz/dns.c
DNS Query Code in C with linux sockets
//DNS Query Program on Linux
//Author : Silver Moon (m00n.silv3r@gmail.com)
//Dated : 29/4/2009
//Header Files
#include<stdio.h> //printf
#include<string.h> //strlen
#include<stdlib.h> //malloc
#include<sys/socket.h> //you know what this is for
#include<arpa/inet.h> //inet_addr , inet_ntoa , ntohs etc
@pttsync
pttsync / socket.c
Created August 25, 2022 10:53 — forked from nolim1t/socket.c
HTTP Request in C using low level write to socket functionality
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <unistd.h>
#include <fcntl.h>
#include <netinet/tcp.h>
#include <sys/socket.h>
#include <sys/types.h>
#include <netinet/in.h>
@pttsync
pttsync / flutter-ffi-async-nativeport.md
Created May 16, 2022 16:18 — forked from espresso3389/flutter-ffi-async-nativeport.md
Async messaging between Flutter and C++ using Dart ffi NativePort

C++

  • Copy Dart SDK (${FLUTTER_DIR}/bin/cache/dart-sdk/include) to your project, e.g. ios/Classes/
  • Add your own code like the following fragment
#include "dart_api_dl.h"

// Receives NativePort ID from Flutter code
static Dart_Port_DL dart_port = 0;
@pttsync
pttsync / v2ray-tp.sh
Created December 18, 2021 14:15 — forked from tossmilestone/v2ray-tp.sh
V2ray transparent proxy for TCP
#!/bin/sh
install_v2ray(){
echo "Install v2ray..."
if [[ ! -f /usr/bin/v2ray/v2ray ]]
then
curl -Ls https://install.direct/go.sh | bash
fi
mkdir -p /etc/v2ray