Skip to content

Instantly share code, notes, and snippets.

@Tanete
Tanete / CGSW.c
Last active August 29, 2015 14:12
Conjugate Gradient Method + Strong Wolfe Condition
#include <stdio.h>
#include <math.h>
#define N 21 // number of variables +1 (shouble be odd)
double delta_1 = 1E-4; // strong wolfe condition Rule1 delta_1
double delta_2 = 0.1; // strong wolfe condition Rule2 delta_2
double epsilon = 1E-6;
// define f function
double f(double x[N]) {
@Tanete
Tanete / railsbox_error_info
Created January 23, 2015 08:41
Try to use #railsbox to create new Ruby on Rails server on Windows PC. Run vagrant up and terminal output like this.
D:\Program Files\Dropbox\Project\rails10-meetup-railsbox\railsbox
vagrant up
checking for ansible-playbook... no
Bringing machine 'rails10-meetup' up with 'virtualbox' provider...
==> rails10-meetup: Importing base box 'trusty64'...
==> rails10-meetup: Matching MAC address for NAT networking...
==> rails10-meetup: Setting the name of the VM: railsbox_rails10-meetup_1422001421257_90292
==> rails10-meetup: Clearing any previously set forwarded ports...
==> rails10-meetup: Clearing any previously set network interfaces...
==> rails10-meetup: Preparing network interfaces based on configuration...
@Tanete
Tanete / ruff-music.js
Last active August 30, 2016 06:09
demo for playing music with ruff
'use strict';
// var f = [262, 294, 330, 349, 392, 440, 494, 523, 587, 659, 698, 784, 880, 988, 1047, 1175, 1319, 1397, 1568, 1760, 1976];
// var f = [1, 262, 294, 330, 349, 392, 440, 494];
var f = [1, 523, 587, 659, 698, 784, 880, 988, 1047]
var duration = 400;
var gap = 80;
This is ApacheBench, Version 2.3 <$Revision: 1528965 $>
Copyright 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/
Licensed to The Apache Software Foundation, http://www.apache.org/
Benchmarking localhost (be patient)
Server Software:
Server Hostname: localhost
Server Port: 8080
并发用户数 吞吐率(reqs/s) 请求等待时间(ms) 请求处理时间(ms)
1 3371.31 0.296 0.296
2 3468.59 0.577 0.288
5 3578.76 1.397 0.279
10 3616.40 2.765 0.277
20 3605.91 5.547 0.277
50 3273.38 15.299 0.306
100 3550.69 28.165 0.281
200 3445.74 58.060 0.290
500 3410.83 146.605 0.293
@Tanete
Tanete / netdb-on-linux-mint.md
Last active November 20, 2018 09:18
Fix "cannot rename due to errors: /usr/local/go/src/net/cgo_linux.go:10:19: fatal error: netdb.h: no such file or directory" error on LinuxMint

Fix "cannot rename due to errors: /usr/local/go/src/net/cgo_linux.go:10:19: fatal error: netdb.h: no such file or directory" error on LinuxMint

  • Using Visual Studio Code on Linux Mint 18.1 Cinnamon Edition.

  • Trying to use Rename Symbol feature (gorename) to rename variable name.

  • Error message "cannot rename due to errors: /usr/local/go/src/net/cgo_linux.go:10:19: fatal error: netdb.h: no such file or directory"

  • Missing netdb.h on Linux Mint like this post?