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 / chat-demo.rs
Created September 29, 2021 08:21
chat demo in rust
use std::net::SocketAddr;
// tokio = { version = "1.12.0", features = ["full" ] }
use tokio::{
io::{AsyncBufReadExt, AsyncWriteExt, BufReader},
net::TcpListener,
sync::broadcast,
};
#[tokio::main]
@ssrlive
ssrlive / objc-in-liunx.md
Last active October 30, 2021 04:45
Objective-C on Linux

install

sudo apt-get install -y build-essential gobjc gobjc++ gnustep gnustep-devel libgnustep-base-dev

sample.m

#import <Foundation/Foundation.h>

@interface C
#include <errno.h>
#include <fcntl.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <sys/types.h>
#if defined(_MSC_VER)
#include <WinSock2.h>
#include <ws2tcpip.h>
#include <wepoll.h>
@ssrlive
ssrlive / ssr-build.cmd
Last active November 28, 2021 05:08
build ssr-native on windows
git clone --recurse-submodules https://github.com/ShadowsocksR-Live/shadowsocksr-native.git ssr-n
mkdir .\ssr-n\build
cd .\ssr-n\build
cmake ..
cmake --build . --config Release
@ssrlive
ssrlive / CMakeLists.txt
Last active November 30, 2021 07:11
Leaning AF_UNIX socket and pthread
cmake_minimum_required(VERSION 3.4.1)
project(afunix)
add_executable( afsocket server.c client.c main.c )
target_link_libraries( afsocket pthread )
@ssrlive
ssrlive / tw.py
Created December 5, 2021 02:41
Tweet with images
import tweepy
consumer_key = u""
consumer_secret = u""
access_token = u""
access_token_secret = u""
auth = tweepy.OAuthHandler(consumer_key, consumer_secret)
auth.set_access_token(access_token, access_token_secret)
@ssrlive
ssrlive / server.py
Last active December 26, 2021 03:29
Simple HTTPS file server
import http.server, ssl
server_ip = "0.0.0.0"
server_port = 4443
server_key = '/fakesite_cert/domain.key'
server_cert = '/fakesite_cert/chained.pem'
httpd = http.server.HTTPServer(
(server_ip, server_port),
http.server.SimpleHTTPRequestHandler)
@ssrlive
ssrlive / ssh-local-to-public.md
Last active October 12, 2024 14:58
SSH 端口转发实现内网穿透

准备

假设你远程公网主机的 IP 是 123.45.67.89, 首先登录进你的主机

ssh [email protected] -p 22 -i '/your/ssh/key/file.key'

vim 编辑 ssh 服务器的配置文件

sudo vi /etc/ssh/sshd_config
@ssrlive
ssrlive / ssh-login.md
Last active February 18, 2022 04:38
ssh 公钥私钥登录的实际流程

ssh 公钥私钥登录的实际流程

客户端建立私钥和公钥

在客户端终端运行命令

ssh-keygen -t rsa

rsa 是一种密码算法,证书登录常用 rsa。

@ssrlive
ssrlive / evtst.c
Created February 21, 2022 11:43
libev test code.
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <errno.h>
#include <sys/types.h>
#include <netinet/in.h>
#include <arpa/inet.h>
#include <unistd.h>
#include <sys/socket.h>
#include <ev.h>