Skip to content

Instantly share code, notes, and snippets.

Avatar
🗿
.

Bob Poekert bobpoekert

🗿
.
View GitHub Profile
@aaronhoffman
aaronhoffman / TileSystem.cs
Created May 26, 2016
Convert WGS84, latitude, longitude, to Web Mercator, Google Maps, Bing Maps, Pixel Coordinates
View TileSystem.cs
// source: https://msdn.microsoft.com/en-us/library/bb259689.aspx
//------------------------------------------------------------------------------
// <copyright company="Microsoft">
// Copyright (c) 2006-2009 Microsoft Corporation. All rights reserved.
// </copyright>
//------------------------------------------------------------------------------
using System;
using System.Text;
@taoari
taoari / caffe_graph_net.py
Created Mar 20, 2015
CAFFE visualize net prototxt with graphviz
View caffe_graph_net.py
#!/usr/bin/env python
import caffe
from caffe.proto import caffe_pb2
from google.protobuf import text_format
class structtype:
pass
def loadSolver(fn):
with open(fn) as f:
@gubatron
gubatron / compiling_building_c_cpp_notes.md
Last active Apr 12, 2021
Things to remember when compiling and linking C/C++ programs
View compiling_building_c_cpp_notes.md

Things to remember when compiling/linking C/C++ software

by Angel Leon. March 17, 2015; August 29, 2019.

Include Paths

On the compilation phase, you will usually need to specify the different include paths so that the interfaces (.h, .hpp) which define structs, classes, constans, and functions can be found.

With gcc and llvm include paths are passed with -I/path/to/includes, you can pass as many -I as you need.

In Windows, cl.exe takes include paths with the following syntax: /I"c:\path\to\includes\ you can also pass as many as you need.

@saaj
saaj / ranking.py
Created Jun 9, 2014
Python SQLite ranking functions for sqlitefts
View ranking.py
# -*- coding: utf-8 -*-
'''
Ranking code based on:
https://github.com/coleifer/peewee/blob/master/playhouse/sqlite_ext.py
'''
import struct
import math
@lelandbatey
lelandbatey / whiteboardCleaner.md
Last active Apr 6, 2021
Whiteboard Picture Cleaner - Shell one-liner/script to clean up and beautify photos of whiteboards!
View whiteboardCleaner.md

Description

This simple script will take a picture of a whiteboard and use parts of the ImageMagick library with sane defaults to clean it up tremendously.

The script is here:

#!/bin/bash
convert "$1" -morphology Convolve DoG:15,100,0 -negate -normalize -blur 0x1 -channel RBG -level 60%,91%,0.1 "$2"

Results

View robpike.cljs
;; based on http://talks.golang.org/2012/concurrency.slide#50
(ns robpike
(:require [cljs.core.async :as async :refer [<! >! chan close!]])
(:require-macros [cljs.core.async.macros :as m :refer [go alt!]]))
(defn timeout [ms]
(let [c (chan)]
(js/setTimeout (fn [] (close! c)) ms)
c))
@jboner
jboner / latency.txt
Last active Apr 19, 2021
Latency Numbers Every Programmer Should Know
View latency.txt
Latency Comparison Numbers (~2012)
----------------------------------
L1 cache reference 0.5 ns
Branch mispredict 5 ns
L2 cache reference 7 ns 14x L1 cache
Mutex lock/unlock 25 ns
Main memory reference 100 ns 20x L2 cache, 200x L1 cache
Compress 1K bytes with Zippy 3,000 ns 3 us
Send 1K bytes over 1 Gbps network 10,000 ns 10 us
Read 4K randomly from SSD* 150,000 ns 150 us ~1GB/sec SSD
@GaelVaroquaux
GaelVaroquaux / 00README.rst
Last active Apr 1, 2021
Copy-less bindings of C-generated arrays with Cython
View 00README.rst

Cython example of exposing C-computed arrays in Python without data copies

The goal of this example is to show how an existing C codebase for numerical computing (here c_code.c) can be wrapped in Cython to be exposed in Python.

The meat of the example is that the data is allocated in C, but exposed in Python without a copy using the PyArray_SimpleNewFromData numpy