Skip to content

Instantly share code, notes, and snippets.

View lclarkmichalek's full-sized avatar

Laurie Clark-Michalek lclarkmichalek

View GitHub Profile
import numpy as np
import timeit
def random_data(N):
return np.random.uniform(0., 10., N)
array1 = np.array([random_data(4) for _ in range(1000)])
array2 = np.array([random_data(4) for _ in range(2000)])
def func():
lst = []
for elem in array1:
# Define factors.

Keybase proof

I hereby claim:

  • I am bluepeppers on github.
  • I am laurie (https://keybase.io/laurie) on keybase.
  • I have a public key whose fingerprint is 98BC 10D8 A9C5 33D6 0AB9 3258 CED0 3418 C4FE 580C

To claim this, I am signing this object:

struct Config
{
bool good_config;
bool spew;
std::string spew_channel;
std::string admin_channel;
std::string irc_server;
int irc_port;
@lclarkmichalek
lclarkmichalek / fsfds.py
Created June 15, 2011 19:32 — forked from anonymous/fsfds.py
debugging context manager
import time, logging
class debug_watch:
def __init__(self, name, logger=logging.info):
self.name = name
self.logger = logger
def __enter__(self):
self.t = time.time()
self.logger("Starting %s" % self.name)
@lclarkmichalek
lclarkmichalek / main.lua
Created August 30, 2011 15:00
Spiral 2
-- Constants
a = 1
n = 1
function spiral(theta)
-- Work out the polar equation
local r = a * theta ^ (1/n)
-- Convert to cartesian coordinates
local x = r * math.sin(theta)
local y = r * math.cos(theta)
@lclarkmichalek
lclarkmichalek / main.lua
Created August 30, 2011 15:19
Spiral 1
-- Constants
a = 1
n = 1
function spiral(theta)
-- Work out the polar equation
local r = a * theta ^ (1/n)
-- Convert to cartesian coordinates
local x = r * math.sin(theta)
local y = r * math.cos(theta)
@lclarkmichalek
lclarkmichalek / gist:1653245
Created January 21, 2012 16:43
Benchmark of lazy properties in python
from __future__ import print_function
import timeit
t1 = """
class Test():
_bar = None
@property
def bar(self):
if self._bar is not None:
@lclarkmichalek
lclarkmichalek / gist:1657284
Created January 22, 2012 14:52
Flymake mode for golang
(require 'flymake)
(defvar go-compiler "8g")
(defun flymake-go-init ()
(let* ((temp-file (flymake-init-create-temp-buffer-copy
'flymake-create-temp-inplace))
(local-file (file-relative-name
temp-file
(file-name-directory buffer-file-name))))
diff --git a/shader.go b/shader.go
index 9be9c52..aec8742 100644
--- a/shader.go
+++ b/shader.go
@@ -39,15 +39,15 @@ func (shader Shader) GetSource() string {
var length C.GLint
C.glGetShaderiv(C.GLuint(shader), C.GLenum(SHADER_SOURCE_LENGTH), &length)
- log := C.malloc(C.size_t(len + 1))
- C.gogl_glGetShaderSource(C.GLuint(shader), C.GLsizei(len), nil, (*C.GLchar)(log))
url := fmt.Sprintf("%v/dist/v1/%v/artifact/%v/%v", baseURL, repoName, version, runtime.GOOS)
debug("GET", url)
resp, err := client.Get(url)
if err != nil {
return errors.Wrap(err, "could not request latest version download")
}
defer resp.Body.Close()
debug("GET", resp.StatusCode, url)
if !(200 <= resp.StatusCode && resp.StatusCode < 300) {
data, _ := ioutil.ReadAll(resp.Body)