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" | |
"log" | |
"os" | |
"strconv" | |
) | |
const ( |
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" | |
) | |
func main() { | |
var N = 12 | |
for i := 0; i <= N; i++ { | |
for j := 0; j <= i; j++ { |
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" | |
) | |
var maze [][]int = [][]int{ | |
{2, 2, 2, 2, 2, 2, 2, 2, 2, 2}, | |
{2, 0, 0, 0, 2, 0, 0, 0, 2, 2}, | |
{2, 0, 2, 0, 2, 0, 2, 2, 0, 2}, |
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" | |
) | |
var flags = []int{1,2,3,3,2,1,1,2,3} | |
func main() { | |
var i, j, n int |
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" | |
"os" | |
"strconv" | |
) | |
var count int | |
func hanoi(n int, a, b, c string){ | |
if n == 1{ | |
count++ |
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
#ifdef WIN32 | |
#include <winsock2.h> | |
#include <Ws2tcpip.h> | |
#include <string.h> | |
#include <stdint.h> | |
#include <stdio.h> | |
int inet_pton4(const char *src, char *dst); | |
int inet_pton6(const char *src, char *dst); | |
int inet_pton(int af, const char *src, char *dst) |
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
#限制单个ip的tcp的并发连接数为30 | |
iptables -A INPUT -p tcp -m connlimit --connlimit-above 30 -j DROP | |
#限制连接web服务的连接速度, 单个ip在10s内只允许建立10个新连接 | |
iptables -A INPUT -p tcp -m multiport --dport 80,443 -m state --state NEW --set --name web | |
iptables -A INPUT -p tcp -m multiport --dport 80,443 -m state --state NEW --update --name web \ | |
--hitcount 10 --seconds 10 -j REJECT |
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
from twisted.internet import reactor, protocol | |
class EchoClient(protocol.Protocol): | |
def connectionMade(self): | |
reactor.callLater(0, self.send_data, "1111") | |
def send_data(self, data): | |
self.transport.write(data) | |
reactor.callLater(0, self.send_data, "1111") |
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 ( | |
//"net" | |
//"net/http" | |
"fmt" | |
"log" | |
//"os" | |
"flag" | |
"os/exec" |
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
#!python | |
import zipfile | |
import os | |
def unzip(filename, output_dir=".", filename_encode="gbk"): | |
fp = zipfile.ZipFile(filename, "r") | |
# get name list |
OlderNewer