Skip to content

Instantly share code, notes, and snippets.

View robotsorcerer's full-sized avatar
🙂

Lekan robotsorcerer

🙂
View GitHub Profile
@robotsorcerer
robotsorcerer / packages.sh
Last active April 1, 2017 19:23
Ubuntu 14.04 One-time packages set-up
#olalekan ogunmolu
#June 25, 2014
#I generally use this script to do my basic package installation after a dry format of ubuntu 14.04.2 LTS
#!/bin/bash
#creates most of the packages I normally use in ubuntu
echo "setting up sources for ros indigo"
sudo sh -c 'echo "deb http://packages.ros.org/ros/ubuntu $(lsb_release -sc) main" > /etc/apt/sources.list.d/ros-latest.list'
echo "setting up your ros keys"
sudo apt-key adv --keyserver hkp://pool.sks-keyservers.net --recv-key 0xB01FA116
@robotsorcerer
robotsorcerer / CMakeLists.txt
Last active May 4, 2017 16:02
Implements Python and Matlab header files
cmake_minimum_required(VERSION 2.8.12)
project(xbox_tracker)
SET(CMAKE_BUILD_TYPE RelWithDebInfo)
find_package(PkgConfig)
find_package(PythonLibs REQUIRED)
find_package(Matlab REQUIRED)
find_package(OpenCV REQUIRED)
@robotsorcerer
robotsorcerer / CMakeLists.txt
Created May 4, 2017 15:59
Compiles Opencv.cpp examples. Simply create a build dir within the samples.cpp dir of your opencv clone and build with cmake . && make -j
cmake_minimum_required(VERSION 2.8.3)
project(opencv_examples)
OPTION(ENABLE_CXX11 "Enable C++11 support" ON)
IF(ENABLE_CXX11)
INCLUDE(CheckCXXCompilerFlag)
CHECK_CXX_COMPILER_FLAG("-std=c++11" COMPILER_SUPPORTS_CXX11)
CHECK_CXX_COMPILER_FLAG("-std=c++0x" COMPILER_SUPPORTS_CXX0X)
IF(COMPILER_SUPPORTS_CXX11)
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11")
@robotsorcerer
robotsorcerer / CMakeLists.txt
Created May 4, 2017 16:26
OpenCV CmakeLists custom compiler
# ----------------------------------------------------------------------------
# Root CMake file for OpenCV
#
# From the off-tree build directory, invoke:
# $ cmake <PATH_TO_OPENCV_ROOT>
#
#
# - OCT-2008: Initial version <joseluisblancoc@gmail.com>
#
# ----------------------------------------------------------------------------
import scipy
import logging
import argparse
import scipy.io as sio
from scipy.sparse import load_npz, \
csc_matrix, save_npz, vstack
from os.path import join, expanduser
from .utils.optim import FMO
logging.basicConfig(format='%(levelname)s:%(message)s', level=logging.DEBUG)
import h5py
import numpy as np
from skimage.transform import resize
import os
import logging
from os.path import join, expanduser
logger = logging.getLogger(__name__)
import os
import copy
import time
import random
import h5py
import h5sparse
import logging
import numpy as np
from scipy.sparse import vstack
@robotsorcerer
robotsorcerer / mac_dev_setup.sh
Created August 15, 2018 03:45 — forked from captainsafia/mac_dev_setup.sh
A set of commands I use to configure my Mac for development
# Create a global gitignore for macOS
curl https://raw.githubusercontent.com/github/gitignore/master/Global/macOS.gitignore >> ~/.gitignore_global
git config --global core.excludesfile ~/.gitignore_global
# Send screenshots to a directory that isn't the desktop
mkdir -p ~/Screenshots
defaults write com.apple.screencapture location ~/Screenshots
# Show all hidden files (like dotfiles)
defaults write com.apple.finder AppleShowAllFiles YES; killall Finder;
import os
import cupy as cp
import numpy as np
class chambollepock(object):
def __init__(self):
self.proxops = proxops()
self.variables = cpk_variables()
self.applyK = cpk_applyK()
self.optimizer = cpk_optimizer(self)
import numpy as np
"""
For details, see
[1] https://people.eecs.berkeley.edu/~wkahan/ieee754status/IEEE754.PDF
[2] https://docs.scipy.org/doc/numpy/reference/generated/numpy.around.html?highlight=round#numpy.around
Thanks to fesetround from ctypes. We can manually set the rounding mode
"""
import ctypes, sys