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
| fun = {@(x)sum(-x.*sin(sqrt(abs(x))), 2), | |
| @(x)sum(x.^2-10*cos(2*pi*x)+10,2), | |
| @(x)-20*exp(-0.2*sqrt(sum(x.^2,2)/30))-exp(sum(cos(2*pi*x),2)/30)+20+exp(1), | |
| @(x)sum(x.^4-16*x.^2+x,2)/100, | |
| @(x)sum((1-x(:,1:end-1)).^2 + 100*(x(:,2:end)-x(:,1:end-1).^2).^2,2), | |
| @(x)sum(x.^2,2), | |
| @(x)sum(x.^4,2)+rand(size(x, 1),1), | |
| @(x)sum(abs(x),2)+prod(abs(x),2), | |
| @(x)max(abs(x), [], 2)}; | |
| lb = {-500*ones(1, 30), |
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
| f = xlsread('C:\Documents and Settings\Administrator\桌面\恒定流-非恒定流关系图.xls') | |
| fun = @(x, xdata)xdata(:, 3).* xdata(:, 4).^ x(1).* xdata(:, 5).^x(2).*xdata(:, 6).^ x(3)* x(4); | |
| lsqcurvefit(fun, rand(4, 1), f, f(:, 2)) | |
| %% output | |
| -1.99891623025666 | |
| 0.627151427841047 | |
| -0.0645792624367950 | |
| 8.20564570528408 |
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
| pe3 | |
| @time for i = 1:10 | |
| factor(600851475143)|>keys|>maximum|>println | |
| end | |
| pe4 | |
| function pe4() |
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
| package main | |
| import ( | |
| "flag" | |
| "fmt" | |
| "io" | |
| "time" | |
| ) | |
| func newReader() io.Reader { |
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
| package main | |
| import ( | |
| "fmt" | |
| "time" | |
| ) | |
| type e struct{} | |
| func chanErr(produceErr bool, d time.Duration, noErrChan chan e) chan e { |
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/python | |
| # -*- coding: utf-8 -*- | |
| import os | |
| import codecs | |
| import random | |
| import string | |
| from hashlib import md5 | |
| from multiprocessing import Pool | |
| PROCESSES = 10 | |
| LENGTH = 8192*5+777 |
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
| /* | |
| rm -f /tmp/out.txt && gcc cwrite.c && ./a.out $BUFSIZE $LINELEN --fbf && cat out.txt | while read l; do echo ${#l}; done | sort -u | |
| */ | |
| #include <stdlib.h> | |
| #include <unistd.h> | |
| #include <sys/wait.h> | |
| #include <stdio.h> | |
| #include <fcntl.h> | |
| #include <string.h> |
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 os | |
| import sys | |
| def main(): | |
| line = 'x' * (int(sys.argv[1]) - 1) + '\n' | |
| buf_mode = {'--nbf': 0, '--lbf': 1, '--fbf': 2}[sys.argv[2]] | |
| for _ in range(10): | |
| pid = os.fork() |
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
| package main | |
| import ( | |
| "bufio" | |
| "flag" | |
| "fmt" | |
| "log" | |
| "net/http" | |
| _ "net/http/pprof" | |
| "os" |