Save an integer within the range [0, 127] in 1 bytes.
+--------+
|0XXXXXXX|
+--------+
#!/bin/bash | |
# Generate the frames | |
for i in {0..1800} | |
do | |
echo "Generating frame $i" | |
convert -background black -fill white -size 480x320 -pointsize 48 -gravity center label:${i} frame${i}.png | |
done | |
# Combine frames into H.264 MP4 video. (29.97fps & 30fps) |
package store | |
import ( | |
"fmt" | |
"github.com/boltdb/bolt" | |
) | |
// reap removes sessions older than a given duration. | |
// This function assumes that all session data is stored in a "sessions" bucket |
By moving the interface to the application-side (application.go
), you can still set the implementation-specific configuration details when you instantiate your library structs. If the interface was implemented on the library-side then you would need to provide:
type DB interface {
Get([]byte) ([]byte, error)
Put([]byte, []byte) error
CacheSize() int
SetCacheSize(int)
^ = The pointer to the initial element of the slice. | |
--- | |
1. Initial queue (size=0, capacity=3) | |
------- | |
| | | | | |
------- |
Create an empty directory, download the code and run it:
$ mkdir /tmp/lj
$ cd /tmp/lj
$ wget https://gist.github.com/benbjohnson/5622779/raw/e53d227ebdbea8d513b62ad076feb3f6ac1c1594/luajit.go
$ go run luajit.go
And you should see:
package main | |
import ( | |
"encoding/binary" | |
"log" | |
"time" | |
"github.com/boltdb/bolt" | |
) |
package main | |
import ( | |
"encoding/json" | |
"errors" | |
"flag" | |
"fmt" | |
"io" | |
"io/ioutil" | |
"log" |
Setup Go cross-compile using Dave Cheney's instructions & package.
Copy the myapp.conf
file to /etc/init/myapp.conf
. Change the name of the service to whatever you want to call it.
Change the name parameter in myapp.conf
to your application's name.
Change the script
/ end script
block to whatever you need to startup your app.
# This is what I have so far. The Go 1.2 installation doesn't seem to be correct so it's still breaking. | |
rm -rf /usr/local/go/src/pkg/appengine | |
rm -rf /usr/local/go/src/pkg/appengine_internal | |
rm /usr/local/go/src/pkg/os/error_posix.go | |
wget -O golang-crosscompile-master.zip https://github.com/davecheney/golang-crosscompile/archive/master.zip | |
unzip golang-crosscompile-master.zip | |
source golang-crosscompile-master/crosscompile.bash | |
go-crosscompile-build darwin/amd64 |