Skip to content

Instantly share code, notes, and snippets.

View jschwinger233's full-sized avatar
😭
On vacation

graymon jschwinger233

😭
On vacation
  • China
View GitHub Profile
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),
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
pe3
@time for i = 1:10
factor(600851475143)|>keys|>maximum|>println
end
pe4
function pe4()
We couldn’t find that file to show.
@jschwinger233
jschwinger233 / tee.go
Created October 18, 2018 07:18 — forked from wrfly/tee.go
io tee problem
package main
import (
"flag"
"fmt"
"io"
"time"
)
func newReader() io.Reader {
@jschwinger233
jschwinger233 / selectErrors.go
Created October 22, 2018 17:13 — forked from wrfly/selectErrors.go
error selection
package main
import (
"fmt"
"time"
)
type e struct{}
func chanErr(produceErr bool, d time.Duration, noErrChan chan e) chan e {
#!/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
/*
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>
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()
package main
import (
"bufio"
"flag"
"fmt"
"log"
"net/http"
_ "net/http/pprof"
"os"