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
const ( | |
// spliceNonblock makes calls to splice(2) non-blocking. | |
spliceNonblock = 0x2 | |
// maxSpliceSize is the maximum amount of data Splice asks the kernel to move in | |
// a single call to splice(2). | |
maxSpliceSize = 4 << 20 | |
) | |
func Splice(reader, writer *os.File) (traffic int64, err error) { |
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
events { | |
use epoll; | |
worker_connections 1024; | |
} | |
http { | |
geo $china_ip { | |
default 0; | |
1.0.1.0/24 1; | |
1.0.2.0/23 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
#!/usr/bin/env bash | |
# Shell script for initializing development environment in ubuntu | |
set -ex | |
export DEBIAN_FRONTEND=noninteractive | |
# Set locale, which takes effect after re-login | |
apt install -y language-pack-zh-hans | |
update-locale --reset LANG=zh_CN.UTF-8 |
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
# -*- coding:utf-8 -*- | |
from requests import get | |
from filetype import guess | |
from os import rename | |
from os import makedirs | |
from os.path import exists | |
from json import loads | |
from contextlib import closing |
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
<?xml version="1.0" encoding="UTF-16"?> | |
<Task version="1.4" xmlns="http://schemas.microsoft.com/windows/2004/02/mit/task"> | |
<RegistrationInfo> | |
<Date>2020-03-11T10:53:56.3761486</Date> | |
<Author>DESKTOP-EEQJ5NU\devel</Author> | |
<URI>\RestRegularly</URI> | |
</RegistrationInfo> | |
<Triggers> | |
<TimeTrigger> | |
<Repetition> |
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
set -e | |
KERNEL_TAG=${KERNEL_TAG:-"v5.10.32"} | |
# 安装编译依赖 | |
sudo sed -i "s/# deb-src/deb-src/g" /etc/apt/sources.list | |
sudo apt-get update | |
sudo apt-get build-dep linux -y | |
# 下载内核源码 | |
sudo apt-get install git -y |
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
# If you come from bash you might have to change your $PATH. | |
export PATH=/snap/bin:$HOME/.local/bin:$PATH | |
# Path to your oh-my-zsh installation. | |
export ZSH="${HOME}/.oh-my-zsh" | |
# Set name of the theme to load --- if set to "random", it will | |
# load a random theme each time oh-my-zsh is loaded, in which case, | |
# to know which specific one was loaded, run: echo $RANDOM_THEME | |
# See https://github.com/ohmyzsh/ohmyzsh/wiki/Themes |
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
# Run this script with PowerShell: PowerShell -ExecutionPolicy Bypass C:\path\to\scirpt | |
$remoteport = bash.exe -c "ifconfig eth0 | grep 'inet '" | |
$found = $remoteport -match '\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}'; | |
if( $found ){ | |
$remoteport = $matches[0]; | |
} else{ | |
echo "The Script Exited, the ip address of WSL 2 cannot be found"; | |
exit; | |
} |
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
mkdir /opt/images/ | |
rm -f /opt/images/swap | |
# 2GB swap file | |
dd if=/dev/zero of=/opt/images/swap bs=1024 count=2097152 | |
chmod 0600 /opt/images/swap | |
mkswap /opt/images/swap | |
swapon /opt/images/swap |
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 java.io.*; | |
import java.util.regex.Matcher; | |
import java.util.regex.Pattern; | |
public class Main { | |
public static void main(String[] args) throws IOException { | |
System.out.println("args[0] = " + args[0]); | |
System.out.println("args[1] = " + args[1]); | |
BufferedReader bufferedReader = new BufferedReader(new FileReader(args[0])); |
NewerOlder