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
#define NOISE_THRESHOLD 10 | |
#define DIFFERENCE_THRESHOLD 0.05 | |
BOOL hasMoved(void *previous_buffer, void *current_buffer, int WIDTH, int HEIGHT) { | |
int total = WIDTH * HEIGHT; | |
int diff_count = 0; | |
int c = 0, r = 0; | |
for (c = 0; c < HEIGHT; ++c) { |
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
void* resizeBuffer(void *original_buffer, int original_width, int original_height, int final_width, int final_height) { | |
void *resized_buffer = malloc(final_width*final_height); | |
double x_ratio = original_width/(double)final_width ; | |
double y_ratio = original_height/(double)final_height ; | |
double px, py ; | |
for (int i=0;i<final_height;i++) { | |
for (int j=0;j<final_width;j++) { | |
px = floor(j*x_ratio) ; | |
py = floor(i*y_ratio) ; | |
resized_buffer[(i*final_width)+j] = original_buffer[(int)((py*original_width)+px)] ; |
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
//Try to some colors http://en.wikipedia.org/wiki/YUV | |
int chrominance_offset = userdata->width * userdata->height; | |
int v_offset = chrominance_offset / 4; | |
int chroma = 0; | |
if (output_buffer) { | |
mmal_buffer_header_mem_lock(buffer); | |
memcpy(output_buffer->data, buffer->data, buffer->length); | |
int grayOffset; |
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
- (UITableViewCell*) tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { | |
static NSString *cellIdentifier = @"optionsCell"; | |
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:cellIdentifier]; | |
if (cell == nil) { | |
// Primera vez que se crea esta celda, no estaba inicializada aun. | |
cell = [[ UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:cellIdentifier]; | |
UILabel *nivelLabel = [[UILabel alloc] initWithFrame:CGRectZero]; |
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
### Keybase proof | |
I hereby claim: | |
* I am asendra on github. | |
* I am asendra (https://keybase.io/asendra) on keybase. | |
* I have a public key whose fingerprint is C695 260D 3DC2 60F9 395A 0980 FAF6 E1C9 4479 CC46 | |
To claim this, I am signing this object: |
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
#!/bin/bash | |
VM=$1 | |
size=`sudo lvs -o lv_size --unit=b --noheadings /dev/vg_vms/ubuntu-base-vm | sed 's/^ *//'` | |
echo size=$size | |
sudo lvcreate --size=$size --name=vms-$VM vg_vms | |
sudo virt-resize --expand sda1 \ | |
/dev/vg_vms/ubuntu-base-vm /dev/vg_vms/vms-$VM | |
mkdir -p tmp | |
virsh dumpxml ubuntu-base-vm > tmp/ubuntu-base-vm.xml |
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
@interface UIView (Bryan) | |
- (void)updateFrame:(void (^)(CGPoint *origin, CGSize *size))block; | |
@end | |
@implementation UIView (Bryan) | |
- (void)updateFrame:(void (^)(CGPoint *origin, CGSize *size))block { | |
CGRect frame = self.frame; |
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
// Example: | |
// | |
// Widont makes the last space non-breaking | |
// so you don't end up with one word on its | |
// own. | |
// | |
// Widont makes the last space non-breaking | |
// so you don't end up with one word on | |
// its own. | |
// |