This file contains 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 | |
if [ "$EUID" -ne 0 ]; then echo "Please run as root"; exit; fi | |
GATEWAY=$(ip route | awk '/default/ {print $3}') | |
INTERFACE=$(ip route | awk '/default/ {print $5}') | |
RESOLVE_CONF=$(cat /etc/resolv.conf) | |
SOCKS_SCHEME="socks5" | |
SOCKS_ADDRESS="127.0.0.1" |
This file contains 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
// Copyright 2007 Timo Bingmann <tb@panthema.net> | |
// Distributed under the Boost Software License, Version 1.0. | |
// (See http://www.boost.org/LICENSE_1_0.txt) | |
// | |
// Original link http://panthema.net/2007/0328-ZLibString.html | |
#include <string> | |
#include <stdexcept> | |
#include <iostream> | |
#include <iomanip> |
This file contains 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
#include <string> | |
#include <locale> | |
#include <codecvt> | |
//UTF-8 to UTF-16 | |
std::string source; | |
//... | |
std::wstring_convert<std::codecvt_utf8_utf16<char16_t>,char16_t> convert; | |
std::u16string dest = convert.from_bytes(source); | |