@ref https://www.timroes.de/2013/09/12/speed-up-gradle/ Put this in ~/.gradle/gradle.properties
org.gradle.daemon=true
org.gradle.jvmargs=-Xmx2048m -XX:MaxPermSize=512m -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8
These are snippets of py.test in action, used in a talk given at | |
PyCon AU 2012 in Hobart, Tasmania. They are all relevant for | |
py.test 2.2 except where specified. Where taken from open source | |
projects I have listed a URL, some examples are from the py.test | |
documentation, some are from my workplace. | |
Apart from things called test_*, these functions should probably | |
be in your conftest.py, although they can generally start life in | |
your test files. |
$ curl -i -XGET https://www.dropbox.com/ | |
HTTP/1.1 200 OK | |
Server: nginx | |
Date: Thu, 30 Jan 2014 00:16:51 GMT | |
Content-Type: text/html; charset=utf-8 | |
Transfer-Encoding: chunked | |
Connection: keep-alive | |
set-cookie: locale=en; expires=Tue, 29 Jan 2019 00:16:51 GMT; Path=/ | |
set-cookie: gvc=MjA..; expires=Tue, 29 Jan 2019 00:16:51 GMT; Path=/; httponly |
$ curl -i -XGET https://www.dropbox.com/static/images/logo.png | |
HTTP/1.1 200 OK | |
Server: nginx | |
Date: Thu, 30 Jan 2014 00:21:48 GMT | |
Content-Type: image/png | |
Content-Length: 4994 | |
Last-Modified: Fri, 12 Oct 2012 02:29:21 GMT | |
Connection: keep-alive | |
ETag: "50778081-1382" |
package main | |
import ( | |
"bufio" | |
"fmt" | |
"io" | |
"log" | |
"os" | |
"strings" | |
) |
#!/bin/bash | |
# bash generate random alphanumeric string | |
# | |
# bash generate random 32 character alphanumeric string (upper and lowercase) and | |
NEW_UUID=$(cat /dev/urandom | tr -dc 'a-zA-Z0-9' | fold -w 32 | head -n 1) | |
# bash generate random 32 character alphanumeric string (lowercase only) | |
cat /dev/urandom | tr -dc 'a-zA-Z0-9' | fold -w 32 | head -n 1 |
@ref https://www.timroes.de/2013/09/12/speed-up-gradle/ Put this in ~/.gradle/gradle.properties
org.gradle.daemon=true
org.gradle.jvmargs=-Xmx2048m -XX:MaxPermSize=512m -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8
# code | |
#!/usr/bin/env python | |
import signal | |
import sys | |
def signal_handler(signal, frame): | |
print 'You pressed Ctrl+C!' | |
sys.exit(0) |
This is the list of exit codes for wget: | |
0 No problems occurred | |
1 Generic error code | |
2 Parse error — for instance, when parsing command-line options, the .wgetrc or .netrc… | |
3 File I/O error | |
4 Network failure | |
5 SSL verification failure | |
6 Username/password authentication failure | |
7 Protocol errors |
module CallPrice | |
function callprice(S0, K, r, T, sigma, paths) | |
Csum = 0.0 | |
for j = 1:paths | |
Zs = randn() | |
Zj = T*(r-sigma.^2/2) + Zs*T.^0.5*sigma | |
STj = exp(Zj)*S0 | |
Csum += exp(-r*T)*max(STj - K,0.0) | |
end | |
return Csum/paths |
package main | |
import ( | |
"fmt" | |
) | |
type Boo interface{ Write(int32) int32 } | |
type Babi struct {} | |