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" | |
) | |
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" | |
) | |
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" | |
"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
#限制单个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
var net=require("net"); | |
var tls = require("tls"); | |
/* listen address and port */ | |
var listen_host = "0.0.0.0"; | |
var listen_port = 8080; | |
/* the upstream https servers */ | |
var servers = [ | |
{host: "a.example.com",port:18080}, |
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
#!/usr/bin/env python | |
# -*- coding: utf-8 -*- | |
import urllib2 | |
import urllib | |
import json | |
import xmlrpclib | |
class PcsLib(object): | |
def __init__(self, access_token, timeout = 10, basepath= "/apps/bypy"): |
NewerOlder