All of the following information is based on go version go1.8.3 darwin/amd64
.
(Bold = supported by go
out of the box, ie. without the help of a C compiler, etc.)
android
darwin
import Foundation | |
import objc | |
import AppKit | |
import sys | |
NSUserNotification = objc.lookUpClass('NSUserNotification') | |
NSUserNotificationCenter = objc.lookUpClass('NSUserNotificationCenter') | |
def notify(title, subtitle, info_text, delay=0, sound=False, userInfo={}): | |
notification = NSUserNotification.alloc().init() |
from keras.layers.core import Layer | |
from keras import initializers, regularizers, constraints | |
from keras import backend as K | |
class Attention(Layer): | |
def __init__(self, | |
kernel_regularizer=None, bias_regularizer=None, | |
kernel_constraint=None, bias_constraint=None, | |
use_bias=True, **kwargs): | |
""" |
FILENAME=$(basename $(pwd)) | |
go test -run=. -bench=. -cpuprofile=cpu.out -benchmem -memprofile=mem.out -trace trace.out | |
go tool pprof -pdf $FILENAME.test cpu.out > cpu.pdf && open cpu.pdf | |
go tool pprof -pdf --alloc_space $FILENAME.test mem.out > alloc_space.pdf && open alloc_space.pdf | |
go tool pprof -pdf --alloc_objects $FILENAME.test mem.out > alloc_objects.pdf && open alloc_objects.pdf | |
go tool pprof -pdf --inuse_space $FILENAME.test mem.out > inuse_space.pdf && open inuse_space.pdf | |
go tool pprof -pdf --inuse_objects $FILENAME.test mem.out > inuse_objects.pdf && open inuse_objects.pdf | |
go tool trace trace.out | |
go-torch $FILENAME.test cpu.out -f ${FILENAME}_cpu.svg && open ${FILENAME}_cpu.svg |
While it's possible to download packages and install them manually, it's such a hassle. Fortunately for us, OS X has an unofficial package manager called http://brew.sh Let's install it. Open you Terminal and paste the following code:
ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
Great. Homebrew will automatically install packages to /usr/local. Conveniently, that directory is already in your include and link paths.
For this configuration you can use web server you like, i decided, because i work mostly with it to use nginx.
Generally, properly configured nginx can handle up to 400K to 500K requests per second (clustered), most what i saw is 50K to 80K (non-clustered) requests per second and 30% CPU load, course, this was 2 x Intel Xeon
with HyperThreading enabled, but it can work without problem on slower machines.
You must understand that this config is used in testing environment and not in production so you will need to find a way to implement most of those features best possible for your servers.
import gdb | |
_Gdead = 6 | |
class SliceValue: | |
"""Wrapper for slice values.""" | |
def __init__(self, val): | |
self.val = val |
A lot of GitHub projects need to have pretty math formulas in READMEs, wikis or other markdown pages. The desired approach would be to just write inline LaTeX-style formulas like this:
$e^{i \pi} = -1$
Unfortunately, GitHub does not support inline formulas. The issue is tracked here.
// How to build: "CC=clang go build" | |
package main | |
import ( | |
"fmt" | |
"net/url" | |
"strconv" | |
"unsafe" | |
) |
readinessProbe: | |
exec: | |
command: ["/root/grpc_health_probe", "-addr=:6666"] | |
initialDelaySeconds: 1 | |
livenessProbe: | |
exec: | |
command: ["/root/grpc_health_probe", "-addr=:6666"] | |
initialDelaySeconds: 2 | |
imagePullPolicy: IfNotPresent |