This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
int perm[SZ]; | |
for (int i = 0; i < SZ; i++) perm[i] = i; | |
// Random permutation the order | |
for (int i = 0; i < SZ; i++) { | |
int j, t; | |
j = rand() % (SZ-i) + i; | |
t = perm[j]; perm[j] = perm[i]; perm[i] = t; // Swap i and j | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
double random_num = (double)rand() / RAND_MAX; | |
for (k = 0; k <= MAX_INTENSITY; k++) | |
{ | |
if (random_num < probs[k]) | |
{ | |
synthesized[i*im_width+j] = k; // update synthesized image | |
break; | |
} | |
else | |
random_num = random_num - probs[k]; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdlib.h> | |
#include <string.h> | |
#include <math.h> | |
#include <complex> // std::complex, std::abs | |
#define CHECK_ACC | |
#define EPS 10e-3 // a very small value | |
// Float matrix | |
template<typename T> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
set(gcf, 'PaperPosition', [0 0 20 10]); | |
% PaperPosition is used for exporting figure | |
% PaperUnits: default inches for U.S., cm for Asia and Euro. normalized is the best choice | |
set(gcf, 'Position', [0 0 20 10]); | |
% Position is used for GUI position | |
% Default unit is pixels | |
% Units: Default pixel | |
xTickLabel = arrayfun(@(x) num2str(x), betas, 'UniformOutput', false); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
import argcomplete, argparse, requests, pprint | |
import types | |
import os, sys, pprint | |
# http://stackoverflow.com/questions/5137497/find-current-directory-and-files-directory | |
cwd = os.getcwd() | |
print cwd | |
sys.path.append(cwd) | |
import todo |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import glob | |
# Update this script to make it clear enough to merge two folders | |
# This is done manually right now | |
pattern = '108GOPRO/G012*.JPG' | |
srcdir = pattern.split('/')[0] | |
prefix = pattern.split('/')[1].split('*')[0] | |
tgtdir = srcdir + '/' + prefix | |
frames = glob.glob(pattern) | |
print 'Srcdir:', ddir, 'Prefix:', prefix, 'Tgtdir:', tgtdir |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
identify *.png |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import bpy | |
from bpy import data as D | |
from bpy import context as C | |
from mathutils import * |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
## | |
bpy.data.objects | |
py.data.objects.keys() | |
# List all objects | |
# ['Camera', 'CustomShapes', 'GZM_Ball025', 'GZM_Breast_L', 'GZM_Breast_R', 'GZM_Circle025', 'GZM_CircleChest', 'GZM_CircleHips', 'GZM_CircleSpine', 'GZM_CrownHips', 'GZM_Cube025', 'GZM_FaceHead', 'GZM_FaceJaw', 'GZM_Foot', 'GZM_FootIK', 'GZM_Gaze', 'GZM_Hand', 'GZM_HandIK', 'GZM_Head', 'GZM_Jaw', 'GZM_Knuckle', 'GZM_LoLid', 'GZM_Master', 'GZM_Neck', 'GZM_RevFoot', 'GZM_RevToe', 'GZM_Root', 'GZM_Shoulder', 'GZM_Toe', 'GZM_Tongue', 'GZM_UpLid', 'Human', 'Human:Body', 'Human:HighPolyEyes', 'Human:jeans01', 'Human:mhair02', 'Human:Shirt01', 'Human:tongue01', 'Sun'] | |
human = bpy.data.objects['Human'] | |
light = bpy.data.objects['Sun'] | |
human.pose |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!env python | |
# script to sync publish this folder to a web server | |
import time | |
datetimeLog = {} | |
def loadTimestamp(): | |
# parse stored log | |
import os | |
timeFormat = '%Y-%m-%dT%H:%M:%SZ' | |
logFilename = '.log' |
OlderNewer