NOTE: the content is out-of-date. All development is moved to the https://github.com/yurydelendik/wasmception
# locations, e.g.
export WORKDIR=~/llvmwasm; mkdir -p $WORKDIR
export INSTALLDIR=$WORKDIR
| // fragment shader | |
| // | |
| // RGBA color to RGBA greyscale | |
| // | |
| // smooth transition based on u_colorFactor: 0.0 = original, 1.0 = greyscale | |
| // | |
| // http://www.johndcook.com/blog/2009/08/24/algorithms-convert-color-grayscale/ | |
| // "The luminosity method is a more sophisticated version of the average method. | |
| // It also averages the values, but it forms a weighted average to account for human perception. | |
| // We’re more sensitive to green than other colors, so green is weighted most heavily. The formula |
| // curl -X POST -H "Content-Type: application/octet-stream" --data-binary '@filename' http://127.0.0.1:5050/upload | |
| package main | |
| import ( | |
| "fmt" | |
| "io" | |
| "net/http" | |
| "os" | |
| "time" |
| #! /bin/sh | |
| GOOS=linux go build -o $2 "$1" | |
| GOOS=linux go build -ldflags="-s -w" -o $2.-sw "$1" | |
| upx -f --brute -o $2.upx $2 | |
| upx -f --brute -o $2.-sw.upx $2.-sw | |
| GOOS=linux gotip build -o $2.tip "$1" | |
| GOOS=linux gotip build -ldflags="-s -w" -o $2.tip.-sw "$1" | |
| upx -f --brute -o $2.tip.upx $2.tip |
NOTE: the content is out-of-date. All development is moved to the https://github.com/yurydelendik/wasmception
# locations, e.g.
export WORKDIR=~/llvmwasm; mkdir -p $WORKDIR
export INSTALLDIR=$WORKDIR
There are three easy to make mistakes in go. I present them here in the way they are often found in the wild, not in the way that is easiest to understand.
All three of these mistakes have been made in Kubernetes code, getting past code review at least once each that I know of.
What do these lines do? Make predictions and then scroll down.
func print(pi *int) { fmt.Println(*pi) }| server { | |
| listen [::]:80; | |
| listen 80; | |
| server_name app.example.com; | |
| return 301 https://$server_name$request_uri; | |
| } | |
| server { |
| package main | |
| import ( | |
| "os" | |
| "log" | |
| "net" | |
| "strconv" | |
| "strings" | |
| ) |
| /* Benchmark implementing the board logic for the game of go and | |
| * exercising it by playing random games. Derived from | |
| * http://www.lysator.liu.se/~gunnar/gtp/brown-1.0.tar.gz | |
| */ | |
| #include <stdio.h> | |
| #include <stdlib.h> | |
| #include <string.h> | |
| #define MAX_BOARD 23 |
| <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> | |
| <html> | |
| <head> | |
| <meta http-equiv="content-type" | |
| content="text/html; charset=ISO-8859-1"> | |
| <title>Fourier Transform in JavaScript</title> | |
| <meta name="keywords" | |
| content="graph, graphs, graphing, JavaScript, DHTML, Clymer, function, functions, Fourier, Fourier transform, FFT"> | |
| <style type="text/css" media="screen"></style> | |
| </head> |
| /* | |
| * Inspired by: http://stackoverflow.com/questions/4360060/video-streaming-with-html-5-via-node-js | |
| */ | |
| var http = require('http'), | |
| fs = require('fs'), | |
| util = require('util'); | |
| http.createServer(function (req, res) { | |
| var path = 'video.mp4'; |