Skip to content

Instantly share code, notes, and snippets.

@OrganicIrradiation
OrganicIrradiation / ESP8266_deepsleep.ino
Created April 19, 2016 18:14
Simple ESP8266 deepsleep example
#include <ESP8266WiFi.h>
const char* ssid = "#########";
const char* password = "#########";
byte connect_wifi() {
byte timeout = 0;
WiFi.mode(WIFI_STA);
WiFi.begin(ssid, password);
@OrganicIrradiation
OrganicIrradiation / equirectangularToStereographic.m
Created March 3, 2016 18:42
Equirectangular to Stereographic Projections (Little Planets) in MATLAB
% Based upon code by nicoptere: http://en.nicoptere.net/?p=315
function outImage = equirectangularToStereographic(FILENAME,OUTSIZE,CAMDIST,WORLDROTATION)
if nargin < 2
OUTSIZE = [1080,1920];
end
if nargin < 3
CAMDIST = 8;
end
if nargin < 4
WORLDROTATION = 0;
@OrganicIrradiation
OrganicIrradiation / blender_gen_shell.py
Last active March 3, 2016 18:55
Preparing a “Blobby” Object for Printing with Shapeways
wallScale = 0.975;
print('Generate inner shell');
bpy.ops.object.duplicate();
innerShell = bpy.data.objects['0431630057 Sphere Tri 5.001'];
bpy.ops.transform.resize(value=(wallScale,wallScale,wallScale));
print('Subtract inner from outer shell');
bpy.context.scene.objects.active = outerShell;
bpy.ops.object.modifier_add(type='BOOLEAN');
@OrganicIrradiation
OrganicIrradiation / gist:ce90aab045748ac7354f
Last active February 27, 2019 17:55
exiftool rename photos and videos with dates and times
cd ~/Pictures/to_process/ && exiftool -config exiftool.config -api largefilesupport=1 '-filename<CreateDate' -d "%Y-%m-%d %H.%M.%S%%-c.%%le" -r -ext jpg -ext mp4 * && cd ~/Pictures/Other/to_process/ && exiftool -config exiftool.config -api largefilesupport=1 '-filename<CreateDate' -d "%Y-%m-%d %H.%M.%S%%-c.%%le" -r -ext jpg -ext mp4 *
workon organize_photos && python organize_photos.py ~/Pictures/to_process/ && python organize_photos.py ~/Pictures/Other/to_process/
workon handbrake_batch_encode && python handbrake_batch_encode.py ~/Pictures
@OrganicIrradiation
OrganicIrradiation / SuperSleepyFio.ino
Created March 23, 2015 10:30
Arduino FIO Low Power Setup
/*
* SuperSleepyFio Example SuperSleepyFio.ino
* Steven A Cholewiak - www.semifluid.com
*
* This sketch takes advantage of the XBee's hibernation mode as
* well as the Ardunio Fio's Power Save Mode to grossly reduce power
* consumption. Purely an example of low power Arduino Fio usage.
*
*/
@OrganicIrradiation
OrganicIrradiation / SuperSleepyTempAndVolts.ino
Created March 23, 2015 10:27
Arduino FIO Internal Voltmeter and Thermometer
/*
* SuperSleepyTempAndVolts SuperSleepyTempAndVolts.ino
* Steven A Cholewiak - www.semifluid.com
*
* This sketch takes advantage of the XBee's hibernation mode as
* well as the Ardunio Fio's Power Save Mode to grossly reduce power
* consumption. Also uses some *supersecret* code to access the Arduino
* Fio's own voltage rail (http://code.google.com/p/tinkerit/wiki/SecretVoltmeter)
* and internal thermometer (http://code.google.com/p/tinkerit/wiki/SecretThermometer).
*
@OrganicIrradiation
OrganicIrradiation / gen_64x64x64_noise.m
Created March 23, 2015 10:16
3D MATLAB noise – effect of changing Gaussian convolution kernel size
i = 64;
for k = 1:2:31
tic;
noise{i,k} = noise3Dwrap(i,k);
imwrite(reshape(noise{i,k},[i i 1 i]),...
['noise3Dwrap_s' num2str(i) 'k' num2str(k) '.gif'],...
'LoopCount',Inf,'DelayTime',0.10);
timeToProcess{i,k} = toc;
save('noise3Dwrap64_k1_31.mat')
end
@OrganicIrradiation
OrganicIrradiation / noise3Dwrap.m
Created March 23, 2015 10:14
3D MATLAB noise (continued)
function s = noise3Dwrap (m,k)
s = zeros([m*3,m*3,m*3]);
w = m;
i = 0;
while w > 3
i = i + 1;
randArray = randn([m,m,m],'single');
randArray = repmat(randArray,[3 3 3]);
d = smooth3(randArray, 'gaussian',k,i);
s = s + i * d(1:(m*3), 1:(m*3), 1:(m*3));
@OrganicIrradiation
OrganicIrradiation / contrast_s.m
Created March 23, 2015 10:10
2D and 3D Perlin Noise in MATLAB
s = (cos(s * pi - pi) + 1) / 2;
@OrganicIrradiation
OrganicIrradiation / demo_ico.m
Created March 23, 2015 10:06
3D “Potato” Generation using Sinusoidal Pertubations
nRecurse = 0;
FV = sphere_tri('ico',nRecurse,[],0);
lighting phong;
shading interp;
figure;
patch('vertices', FV.vertices,'faces', FV.faces, 'facecolor', [0.5 0.5 0.5], 'edgecolor', [.2 .2 .2]);
axis square;
axis off;
camlight infinite;
camproj('orthographic');