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 "github.com/modern-go/concurrent" | |
| executor := concurrent.NewUnboundedExecutor() | |
| executor.Go(func(ctx context.Context) { | |
| everyMillisecond := time.NewTicker(time.Millisecond) | |
| for { | |
| select { | |
| case <-ctx.Done(): | |
| fmt.Println("goroutine exited") | |
| return |
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
| #include <numeric> | |
| #include <algorithm> | |
| #include <random> | |
| #include <vector> | |
| #include <iostream> | |
| #include <limits> | |
| typedef int V; | |
| typedef std::vector<V> vi; |
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 backtype.storm.tuple.Tuple; | |
| import org.slf4j.Logger; | |
| import org.slf4j.LoggerFactory; | |
| import java.util.HashMap; | |
| import java.util.HashSet; | |
| import java.util.Map; | |
| import java.util.Set; | |
| public class StreamTracker { |
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
| from decimal import Decimal | |
| bids = [int(a) for a in '60 62 60 56 56 57'.split('\t')] | |
| print(bids) | |
| price = min(bids) | |
| total_payment = (len(bids) - 1) * price | |
| total_bid = sum(bids) - price | |
| min_pos = bids.index(price) | |
| max_pos = bids.index(max(bids)) | |
| bids[min_pos] = 'min' | |
| bids[max_pos] = 'max' |
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
| #!/bin/sh | |
| # Copyright (C) 2009 Fabian Omar Franzotti <[email protected]> | |
| # http://pastebin.ca/2098184 | |
| # | |
| #include /lib/network | |
| . /etc/functions.sh | |
| . /lib/config/uci.sh | |
| # 传入的参数有 INTERFACE, DEVICE ACTION | |
| # ACTION有:ifup, update, ifdown, changeRoute |
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
| # Dial | |
| pppoecd vlan2 -u $user -p $password # wan1 | |
| pppoecd vlan2 -u $user -p $password # wan2 | |
| # Handle outgoing packet | |
| # Make "ip route" contains a default route like this | |
| # "ip route" final state | |
| #default | |
| # nexthop via $wan1_ip dev $wan1_dev weight 1 # such as 202.106.0.24 ppp0 |
NewerOlder