Skip to content

Instantly share code, notes, and snippets.

#include <xmmintrin.h>
#include <pmmintrin.h>
#include <float.h>
#include "common.h"
#include "linear_math.h"
/**************************************************************************
vec2: two-dimensional vector
**************************************************************************/
@nsf
nsf / go-autocomplete.el
Created December 28, 2010 00:27
Gocode auto-complete-mode setup for emacs
(eval-when-compile (require 'cl))
(defun ac-go-candidates ()
(ac-go-autocomplete))
(defvar ac-source-go
'((candidates . ac-go-candidates)
(prefix . "\\.\\(.*\\)")
(requires . 0)))
[nsf @ go]$ nm _cmake_build/libtermbox.a -S --size-sort
input.c.o:
00000000 000001ee T extract_event
ringbuffer.c.o:
00000050 00000014 T free_ringbuffer
00000070 00000016 T clear_ringbuffer
000000d0 00000030 T ringbuffer_data_size
00000090 0000003c T ringbuffer_free_space
Syntax:
[:CLASS ][!]ARG1 [!]ARG2
or
[:CLASS ][!]ARG1.ARG2
Where CLASS is:
c - const
v - var
@nsf
nsf / runner.go
Created September 26, 2010 17:41
package main
import (
"io/ioutil"
"bytes"
"exec"
"path"
"fmt"
"os"
)
@nsf
nsf / run.rb
Created September 24, 2010 13:03
#!/usr/bin/env ruby
# encoding: utf-8
RED = "\033[0;31m"
GRN = "\033[0;32m"
NC = "\033[0m"
PASS = "#{GRN}PASS!#{NC}"
FAIL = "#{RED}FAIL!#{NC}"
LINE = "████████████████████████████████████████████████████████████████████"
package main
import "fmt"
func worker(num int, done chan bool) {
fmt.Printf("Worker: %d\n", num)
done <- true
}
const NWorkers = 10
package main
import "fmt"
type TableEntry struct {
exectype string
on int
on2 int
on3 int
}
#include <stdio.h>
#include <functional>
//-------------------------------------------------------------------------
// Our main callback class, can be binded to function or member function
// of a particular class easily(?)
//-------------------------------------------------------------------------
template <typename Ret, typename ...Args>
struct funcptr_def {
typedef Ret (*type)(Args...);
(defun ac-go-candidates ()
(ac-go-autocomplete))
(defvar ac-source-go
'((candidates . ac-go-candidates)
(prefix . "\\.\\(.*\\)")
(requires . 0)))
(defun ac-go-get-candidate-strings (tmpbuf)
(split-string (with-current-buffer tmpbuf (buffer-string)) "\n"))