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
use actix_web::client::{Client, ClientRequest}; | |
use actix_web::{get, web, App, Error, HttpRequest, HttpResponse, HttpServer, Responder}; | |
use core::time::Duration; | |
use std::error; | |
use std::io; | |
const EXPOSE_HEADERS: [&str; 7] = [ | |
"accept-ranges", | |
"content-range", | |
"content-length", |
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
function patch_strings_in_file() { | |
local FILE="$1" | |
local PATTERN="$2" | |
local REPLACEMENT="$3" | |
# Find all unique strings in FILE that contain the pattern | |
HASSTRING=$(grep ${PATTERN} ${FILE}) | |
if [ "${HASSTRING}" != "" ] ; then | |
echo "File '${FILE}' contain strings with '${PATTERN}' in them:" |
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
package main | |
import ( | |
"fmt" | |
"io" | |
"net" | |
"os" | |
"sync" | |
) |
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
package main | |
import ( | |
"fmt" | |
"io" | |
"net/http" | |
"os" | |
"time" | |
) |
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
<?php | |
class stream | |
{ | |
private static $ignore=['Host']; | |
public static function init($url) | |
{ | |
$headers = []; | |
foreach(getallheaders() as $k => $v) |
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
<?php | |
$opts = stream_context_create(array( | |
'http'=> array( | |
'method' => 'GET', | |
'header'=> "Host: www.oschina.net\r\nUser-Agent: my file_get_contents use host\r\n", | |
) | |
)); | |
$url = "http://125.39.6.163/news/86646/lftp-4-8-0"; | |
echo file_get_contents($url, null, $opts); |
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
<?php | |
public static function data($items) | |
{ | |
$items=array_column($items,null,'id'); | |
$tree = []; | |
foreach($items as $item) | |
{ | |
if(isset($items[$item['pid']])) | |
{ | |
$items[$item['pid']]['child'][] = &$items[$item['id']]; |
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 | |
# config | |
apiUrl="http://127.0.0.1:9090" | |
# 内网IP | |
if hash ip 2>/dev/null; then |
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 | |
# | |
# Generates client and server certificates used to enable HTTPS | |
# remote authentication to a Docker daemon. | |
# | |
set -e | |
set -x |
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
package main | |
import ( | |
"flag" | |
"fmt" | |
"net/http" | |
"os" | |
"path" | |
"strconv" | |
) |
NewerOlder