Skip to content

Instantly share code, notes, and snippets.

View ialhashim's full-sized avatar

Ibraheem Alhashim ialhashim

View GitHub Profile
@ialhashim
ialhashim / ubuntuPrepareGUI.sh
Last active December 20, 2015 01:09
GUI preparation - Ubuntu @ Amazon EC2
# Update software packages
sudo apt-get update
# Install LXDE desktop
sudo apt-get -y install lxde
# Start desktop service
sudo start lxdm
# Install Remote Desktop
@ialhashim
ialhashim / ubuntuPrepareDevelopment.sh
Last active December 20, 2015 01:09
Development preparation - Ubuntu @ Amazon EC2
# Update software packages
sudo apt-get update
# Download packages: git + gcc
sudo apt-get -y install git g++ make cmake
# Download common packages: jpeg + zlib + python-pip
sudo apt-get -y install libjpeg8-dev libpng-dev zlib1g-dev python-pip
# Download software: ImageMagick
@ialhashim
ialhashim / getBundlerPackage.sh
Last active December 20, 2015 01:09
Get bundler package.
# Clone repos
git clone https://github.com/ennetws/EventCloudBundler.git
git clone https://github.com/ennetws/EventCloudBundlerExtra.git
# Compile bundler
cd EventCloudBundler/bundler
make clean
make
sudo cp bin/libANN_char.so /lib
cd ../..
@ialhashim
ialhashim / gist:8001562
Created December 17, 2013 08:02
Box.com upload API using Qt
#pragma once
#include <QNetworkAccessManager>
#include <QNetworkRequest>
#include <QNetworkReply>
#include <QHttpMultiPart>
#include <QHttpPart>
#include <QFile>
namespace BoxCloud
@ialhashim
ialhashim / SoftwareRenderer
Created December 17, 2013 08:07
3D software rendering of points and lines.
#pragma once
#include <iostream> // std::cout
#include <QImage>
#include <QPainter>
#include <QPoint>
#include <Eigen/Core>
#include <Eigen/Geometry>
#define RADIANS(deg) ((deg)/180.0 * M_PI)
@ialhashim
ialhashim / bluenoise.h
Last active August 29, 2015 13:55
N-dimensional blue-noise sampling
// From Robert Bridson's curlnoise
// Example usage:
// std::vector<Vector3> samples;
// bluenoise_sample<3, double, Vector3>(0.02, Vector3(-0.5,-0.5,-0.5), Vector3(0.5,0.5,0.5), samples );
//
#ifndef BLUENOISE_H
#define BLUENOISE_H
#include <array>
// Code from igl library
// Copyright (C) 2013 Alec Jacobson <alecjacobson@gmail.com>
//
// This Source Code Form is subject to the terms of the Mozilla Public License
// v. 2.0. If a copy of the MPL was not distributed with this file, You can
// obtain one at http://mozilla.org/MPL/2.0/.
#pragma once
#include <Eigen/Geometry>
#include <Eigen/Dense>
//Eigen::MatrixXd src = pointsToMatrix(pointsA[i]);
//Eigen::MatrixXd dst = pointsToMatrix(pointsB[j]);
//Eigen::Matrix4d cR_t = Eigen::umeyama(src, dst, true);
//Eigen::Matrix4d R_t = Eigen::umeyama(src, dst, false);
//Eigen::Matrix3d R = R_t.block(0,0,3,3);
//Eigen::Vector3d t = R_t.block(0,3,3,1);
==============================
Expression: (id=\d)(.+?)(")
==============================
Python script to download:
import os.path
@ialhashim
ialhashim / Cylinder.cpp
Created April 24, 2014 05:41
A Capped 3D Cylinder geoemtry in C++
std::vector<Vector3> spine, spineNormals;
for(int i = 0; i < 10 ; i++){
spine.push_back( Vector3(0,0,0.1 * i) );
#define DEG2RAD 0.01745329
double theta = DEG2RAD * double(i) * M_PI * 2;
spineNormals.push_back(rotatedVec(Vector3(0,0.01,0),theta, Vector3(0,0,1)));
}
// Generate capped cylinder
int numSides = 20, numCaps = numSides * 0.5;