Skip to content

Instantly share code, notes, and snippets.

@bricerebsamen
bricerebsamen / diamond_display.cpp
Created October 17, 2013 02:11
This allows to use OpenGL code in ROS Rviz. Tested in hydro, might work in groovy. Won't work under fuerte (I also have fuerte code available upon request). I am not sure who originally wrote this... Original code credited to a certain wak1pal... I modified it substantially. Enjoy!
#include <OGRE/OgreNode.h>
#include <OGRE/OgreSceneManager.h>
#include <OGRE/OgreCamera.h>
#include <OGRE/OgreRenderQueueListener.h>
#include <rviz/frame_manager.h>
#include <rviz/helpers/color.h>
#include <rviz/visualization_manager.h>
#include <rviz/properties/color_property.h>
#include <rviz/properties/ros_topic_property.h>
@huyng
huyng / .numpy-site.cfg
Last active March 14, 2017 19:36
Place the following in your home directory at ~/.numpy-site.cfg in order to install numpy with openblas support
# Place the following in your home directory at ~/.numpy-site.cfg
# in order to install numpy with openblas support
[openblas]
libraries = openblas
library_dirs = /usr/local/opt/openblas/lib
include_dirs = /usr/local/opt/openblas/include
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@mike-lawrence
mike-lawrence / Makeconf_patch
Created March 3, 2014 17:04
Patch for R's Makeconf on Mavericks (uses clang and gfortran)
--- /Library/Frameworks/R.framework/Resources/etc/Makeconf 2013-09-25 08:59:05.000000000 -0300
+++ Makeconf 2014-03-03 13:01:00.000000000 -0400
@@ -14,11 +14,11 @@
AWK = awk
BLAS_LIBS = -L$(R_HOME)/lib$(R_ARCH) -lRblas
C_VISIBILITY =
-CC = llvm-gcc-4.2 -arch x86_64 -std=gnu99
+CC = clang -arch x86_64 -std=gnu99
CFLAGS = -mtune=core2 -g -O2 $(LTO)
CPICFLAGS = -fPIC
@moorepants
moorepants / example_results.txt
Last active August 12, 2022 16:54
Figuring out how to do speedy evaluation of lists of SymPy expressions.
Testing results.
Timing the functions.
Timing: cython
cython time: 0.00288254904747 s
Timing: numpy_broadcast
numpy_broadcast time: 0.00597401690483 s
@atinfinity
atinfinity / oclMat_custom_kernel.cpp
Last active September 14, 2023 07:26
sample code to execute custom OpenCL kernel on OpenCV 2.4.9
#include <opencv2/core/core.hpp>
#include <opencv2/highgui/highgui.hpp>
#include <opencv2/ocl/ocl.hpp>
// cl_mem構造体を参照するためにインクルード
#if defined __APPLE__
#include <OpenCL/cl.h>
#else
#include <CL/cl.h>
#endif
@HHammond
HHammond / Pandas Table Summary
Last active February 3, 2018 04:51
Pandas Pretty Table CSS
import numpy as np
import pandas as pd
from functools import partial
def summary(df, fn=np.sum, axis=0, name='Total',
table_class_prefix='dataframe-summary'):
"""Append a summary row or column to DataFrame.
Input:
------
import zmq
import time
from multiprocessing import Process
import numpy as np
np.set_printoptions(precision=3)
def send_array(socket, A, flags=0, copy=True, track=False):
"""send a numpy array with metadata"""
md = dict(dtype=str(A.dtype), shape=A.shape)
import zmq
import time
from multiprocessing import Process
import numpy as np
from pprint import pprint
import json
np.set_printoptions(precision=3)
@dchaplinsky
dchaplinsky / declarations_api.py
Last active December 3, 2021 00:06
Simple example of how to export all assets declarations from declarations.com.ua website.
import requests
import json
from time import sleep
data = []
print("Fetching page #%s" % 1)
r = requests.get("http://declarations.com.ua/search?format=opendata").json()
data += r["results"]["object_list"]