Skip to content

Instantly share code, notes, and snippets.

View bobye's full-sized avatar

Jianbo Ye bobye

View GitHub Profile
@bobye
bobye / snapshot3D.sh
Created February 3, 2012 12:05
batch snapshot of 3D objects
#!/bin/sh
echo "## Temp command for Geomview" > tmp.gcl
for filename in $*; do
filebase=$(basename $filename)
outputbase=$(basename $filebase .off)
echo "" >> tmp.gcl
echo "(load $filename geometry)" >> tmp.gcl
echo "(backcolor Camera 1. 1. 1.)" >> tmp.gcl
@bobye
bobye / shape-nav.php
Created February 11, 2012 12:57
Similarity based shape navigation v2
<?php
$imgdir = 'snapshot-repo/';
$allowed_types = array('jpg');
$dimg = opendir($imgdir);
while($imgfile = readdir($dimg))
{
if(in_array(strtolower(substr($imgfile,-3)),$allowed_types))
{
@bobye
bobye / org2doku
Created March 9, 2012 09:44 — forked from takaxp/org2doku
Convert Emacs org-mode formatted text to Dokuwiki formatted one.
#!/opt/local/bin/perl
#
# Modified by @takaxp
# Last Update: 2012-01-09@22:13
# 2012-01-09: support date([YYYY-MM-DD XX]) insertion
# 2012-01-09: support #+BEGIN_SRC
# 2011-11-16: use strict and warnings
# 2011-11-16: Add conversion from numeric items to ` - '.
# 2011-11-16: Skip headers, if #+TITLE: is, use it as the top headline.
# 2011-11-17: Add DISQUS comment
@bobye
bobye / u1204conf
Created August 17, 2012 14:57
Ubuntu 12.04 LTS configuration memo
1. Installation
It is recommended to have a partition at the start of disk, mounted at /boot/
For multiple system boots, boot-repair is very useful. My machine have two disks, one for Windows and one for Linux. I choose the later one as boot device when reparing boots.
2. Basics (step by step)
- time setting in Windows. (for multiple systems installed)
- install Dropbox and Google Drive(Insync) & sync
- install ssh, git & configure GitHub for new machine
[[https://help.github.com/articles/generating-ssh-keys]]
- dot.bashrc, import configuration from github
@bobye
bobye / compute_weights.matlab
Last active December 11, 2015 03:18
compute blend weights offline
%% load std_expr captured data
clear;
dof=24;
header_file = fopen('start_frame.txt');%set header information file
i = 0;
while (1)
[name, count]= fscanf(header_file, '%s',1);
if (count ==0)
break;
end
@bobye
bobye / mArray.hpp
Created June 18, 2013 05:47
multidimensional array of C++
#ifndef _MARRAY_H_
#define _MARRAY_H_
#include <fstream>
#include <iostream>
#include "cv.h"
namespace BSPL {
// 1D array class with overloading operations
template <class T, int Size>
#include <stdio.h>
int dmf(int *a, int n) {
int *I = new int[n];
int k=0;
for (int i=0; i<n; ++i) {
if (a[i] <= a[k]) {
k = i; }
I[i] = k;
}
@bobye
bobye / post_evaluate.matlab
Last active August 29, 2015 14:18
post_evaluate.matlab
% select img_id,artist_id from images into outfile '/tmp/art_wiki_img2artist.csv';
% select task_id,artist_id from tasks into outfile '/tmp/art_wiki_task2artist.csv';
% select usr_id,task_id,chosen from events where usr_id ='admin' into outfile '/tmp/art_wiki_admin.csv' ;
t2a=load('art_wiki_task2artist.csv');
i2a=load('art_wiki_img2artist.csv');
username={'admin', 'fei', 'chenl', 'yukun', 'xinlu'};
@bobye
bobye / prep_img_set.py
Created April 3, 2015 02:18
prep_img_set.py
import os
import Image
import glob
import numpy
def is_grey_scale(img_path="lena.jpg"):
im = Image.open(img_path).convert('RGB')
w,h = im.size
for i in range(w):
for j in range(h):
@bobye
bobye / gist:3c64c2a03a53ce17bfc0
Created December 17, 2015 19:24
create_ohsumed.sh
#!/bin/sh
#wget http://disi.unitn.it/moschitti/corpora/ohsumed-all-docs.tar.gz
#tar xvf ohsumed-all-docs.tar.gz
cd ohsumed-all
filename=ohsumed_clusters.txt
rm -f $filename
for category in C*; do
echo %%%$category >> $filename
for abstract in $category/*; do
tr '\n' ' ' < $abstract | ../tocorpus.pl >> $filename