Skip to content

Instantly share code, notes, and snippets.

View autosquid's full-sized avatar

mightu autosquid

  • HangZhou, ZheJiang, China.
View GitHub Profile
#!/bin/bash
#Heith Seewald 2012
#Feel free to extend/modify to meet your needs.
#Maya on Ubuntu v.1
#This is the base installer... I’ll add more features in later versions.
#if you have any issues, feel free email me at heiths@gmail.com
#### Lets run a few checks to make sure things work as expected.
#Make sure we’re running with root permissions.
if [ `whoami` != root ]; then
@autosquid
autosquid / main.cpp
Created March 7, 2014 10:04
VAO demo
#pragma comment(lib,"glew32.lib")
#include <GL/glew.h>
#include "textfile.h"
#include <GL/glut.h>
#include <iostream>
using namespace std;
GLuint vShader,fShader;//顶点着色器对象
@autosquid
autosquid / markdown template
Created May 2, 2014 07:25
The template I am using to generate a report.
\documentclass[$if(fontsize)$$fontsize$,$endif$$if(lang)$$lang$,$endif$$if(papersize)$$papersize$,$endif$]{$documentclass$}
\usepackage{geometry} % 設定邊界
\geometry{
top=1in,
inner=1in,
outer=1in,
bottom=1in,
headheight=3ex,
headsep=2ex
}
@autosquid
autosquid / boost_ini.cpp
Created May 8, 2014 03:02
parse ini with boost property tree (ptree)
#include <boost/property_tree/ptree.hpp>
#include <boost/property_tree/ini_parser.hpp>
...
boost::property_tree::ptree pt;
boost::property_tree::ini_parser::read_ini("config.ini", pt);
std::cout << pt.get<std::string>("Section1.Value1") << std::endl;
std::cout << pt.get<std::string>("Section1.Value2") << std::endl;
@autosquid
autosquid / tls_samp.cpp
Last active August 29, 2015 14:07 — forked from kumagi/tls_samp.cpp
#include <boost/thread.hpp>
#include <boost/thread/tss.hpp>
#include <boost/bind.hpp>
#include <iostream>
class del{
public:
int dat;
del(int i):dat(i){}
@autosquid
autosquid / ThreadPool
Created October 21, 2014 06:11
ThreadPool with boost thread and asio
namespace bamthread
{
typedef std::unique_ptr<boost::asio::io_service::work> asio_worker;
// the actual thread pool
struct ThreadPool {
ThreadPool(size_t threads) :service(), working(new asio_worker::element_type(service)) {
for ( std::size_t i = 0; i < threads; ++i ) {
auto worker = boost::bind(&boost::asio::io_service::run, &(this->service));
g.add_thread(new boost::thread(worker));
}
@autosquid
autosquid / acvw
Created May 29, 2015 03:20
the cmd-a, cmd-c, cmd-v, cmd-w things: copy text from chrome tabs to textedit (for my bibtex)
on run {input, parameters}
if application "TextEdit" is not running then
tell application "TextEdit"
make new document at the front
end tell
end if
tell application "Google Chrome" to tell tab 1 of window 1
select all
copy selection
@autosquid
autosquid / CMakeLists.patch
Last active August 29, 2015 14:24
open-mesh cmakelists.path
--- OpenMesh-3.3.org/CMakeLists.txt 2015-07-08 11:57:36.000000000 +0800
+++ OpenMesh-3.3/CMakeLists.txt 2015-07-08 11:05:27.000000000 +0800
@@ -60,6 +60,7 @@
endif()
if (APPLE)
+ configure_file ("${CMAKE_SOURCE_DIR}/cmake/fixbundle.cmake.in" "${CMAKE_BINARY_DIR}/fixbundle.cmake" @ONLY IMMEDIATE)
add_custom_target (fixbundle ALL
COMMAND ${CMAKE_COMMAND} -P "${CMAKE_BINARY_DIR}/fixbundle.cmake"
)
@autosquid
autosquid / myfuncwrapper.hpp
Last active November 9, 2016 13:11
my functional
// I hate STL transform.
// I hate iteraters
namespace my{
template<typename T, typename F>
auto map(F f, const std::vector<T> &a ) {
std::vector<std::result_of_t<F(T)>> result;
for(const T & t : a)
result.push_back(f(t));
@autosquid
autosquid / CMakeLists.patch
Created July 26, 2015 08:44
openmesh 4.0 CMakeLists.txt patch for build without app. option
--- openmesh-4.0.org/CMakeLists.txt 2015-07-26 16:27:49.000000000 +0800
+++ openmesh-4.0/CMakeLists.txt 2015-07-26 16:37:59.000000000 +0800
@@ -73,6 +73,7 @@
endif()
if (APPLE)
+ configure_file ("${CMAKE_SOURCE_DIR}/cmake/fixbundle.cmake.in" "${CMAKE_BINARY_DIR}/fixbundle.cmake" @ONLY IMMEDIATE)
add_custom_target (fixbundle ALL
COMMAND ${CMAKE_COMMAND} -P "${CMAKE_BINARY_DIR}/fixbundle.cmake"
)