This file contains hidden or 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
import 'dart:async'; | |
import 'package:flutter/material.dart'; | |
import 'package:video_player/video_player.dart'; | |
void main() => runApp(const VideoPlayerApp()); | |
class VideoPlayerApp extends StatelessWidget { | |
const VideoPlayerApp({super.key}); |
This file contains hidden or 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 | |
for sec in '.BTF.ext' '.eh_frame' '.debug_loc' '.debug_info' '.debug_ranges' '.debug_frame' '.debug_line' | |
do | |
llvm-strip --remove-section $sec $1 | |
done | |
llvm-strip --remove-section .text $1 |
This file contains hidden or 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
use std::io::{Error, Result}; | |
use std::mem::{MaybeUninit, size_of}; | |
use std::net::{Ipv4Addr, Ipv6Addr, SocketAddr, SocketAddrV4, SocketAddrV6}; | |
use std::os::unix::io::AsRawFd; | |
use async_std::net::TcpListener; | |
use futures::StreamExt; | |
#[async_std::main] | |
async fn main() { |
This file contains hidden or 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
use std::collections::HashMap; | |
use std::fs::File; | |
use std::future::Future; | |
use std::io::Error; | |
use std::io::IoSliceMut; | |
use std::io::Result; | |
use std::marker::PhantomData; | |
use std::os::unix::io::AsRawFd; | |
use std::os::unix::io::RawFd; | |
use std::pin::Pin; |
This file contains hidden or 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
use std::io; | |
use std::io::IoSlice; | |
use std::io::IoSliceMut; | |
use std::ops::Deref; | |
use std::ptr::drop_in_place; | |
use std::sync::Mutex; | |
use iou::{CompletionQueue, CompletionQueueEvent, IoUring, Registrar, SubmissionQueue}; | |
struct Ring<'a> { |
This file contains hidden or 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
use std::future::Future; | |
use std::io; | |
use std::io::ErrorKind; | |
use std::io::Result; | |
use std::pin::Pin; | |
use std::sync::Arc; | |
use std::task::{Context, Poll}; | |
use async_std::io::{Read, Write}; | |
use async_std::net::{TcpListener, TcpStream}; |
This file contains hidden or 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
// from https://play.rust-lang.org/?version=stable&mode=debug&edition=2018&gist=fbb7daec1be993d3a4cd6f6181f332a0 | |
use std::future::Future; | |
use std::pin::Pin; | |
use std::thread; | |
use futures::future::{pending, poll_fn}; | |
use lazy_static::lazy_static; | |
use tokio::runtime::{Handle, Runtime}; |
This file contains hidden or 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
// get the original destination for the socket when redirect by linux iptables | |
// refer to https://raw.githubusercontent.com/missdeer/avege/master/src/inbound/redir/redir_iptables.go | |
// | |
const ( | |
SO_ORIGINAL_DST = 80 | |
IP6T_SO_ORIGINAL_DST = 80 | |
) | |
func getOriginalDst(clientConn *net.TCPConn) (rawaddr []byte, host string, newTCPConn *net.TCPConn, err error) { | |
if clientConn == nil { |
This file contains hidden or 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
// get the original destination for the socket when redirect by linux iptables | |
// refer to https://raw.githubusercontent.com/missdeer/avege/master/src/inbound/redir/redir_iptables.go | |
// | |
const ( | |
SO_ORIGINAL_DST = 80 | |
IP6T_SO_ORIGINAL_DST = 80 | |
) | |
func getOriginalDst(clientConn *net.TCPConn) (rawaddr []byte, host string, newTCPConn *net.TCPConn, err error) { | |
if clientConn == nil { |
This file contains hidden or 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
// Map is a functional map, like Kotlin or Rust map. | |
// wantType must be a pointer, If you want return a []*string, | |
// wantType should be **string | |
func Map(slice interface{}, wantType interface{}, f func(v interface{}) interface{}) interface{} { | |
if reflect.TypeOf(slice).Kind() != reflect.Slice { | |
panic("slice type must be slice") | |
} | |
value := reflect.ValueOf(slice) |
NewerOlder