Skip to content

Instantly share code, notes, and snippets.

Edwin Rodríguez edwrodrig

  • Instituto Milenio de Oceanografía
  • Concepción, Chile
Block or report user

Report or block edwrodrig

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@edwrodrig
edwrodrig / insertion_sort_vector.cpp
Last active Aug 29, 2015
Insertion sort using vector
View insertion_sort_vector.cpp
#include <vector>
#include <iostream>
using namespace std;
void print_v(const vector<int>& v) {
for ( vector<int>::const_iterator i = v.begin() ; i != v.end() ; ++i )
cout << *i << " ";
cout << endl;
}
@edwrodrig
edwrodrig / merge.cpp
Created Mar 2, 2014
Merge two sorted arrays
View merge.cpp
#include <iostream>
using namespace std;
int main() {
//int a1[5] = {1,3,5,7,9};
//int a2[5] = {0,2,4,6,8};
//int a1[5] = {1,2,3,4,5};
//int a2[5] = {6,7,8,9,10};
@edwrodrig
edwrodrig / meta.html
Created May 5, 2014
Social meta tags
View meta.html
<html itemscope itemtype="http://schema.org/WebApplication">
<!-- Google data-->
<meta name="description" content="Page description." />
<meta name="keywords" content="a few keywords" />
<meta name="author" content="Edwin Rodríguez" />
<meta name="application-name" content="Page name" />
<!-- Google+ data -->
<meta itemprop="name" content="Page name" />
@edwrodrig
edwrodrig / pitri_angles.html
Last active Aug 29, 2015
Usage demo of pitri.js
View pitri_angles.html
<script src="js/pitri.js"></script>
<script>
var pitri = new pitri(); //pitri object
//all coords are in x, y, z
var eye = [10.0, 10.0, 10.0]; //the position of my eye
var horizontalAngle = 1.0; //horizontal angle of view in radians, 0 is aligned to z plane. Increments turn the angle clockwise
var verticalAngle = 2.0; //vertical angle of view in radians, 0 is aligned to x plane. Increments turn the angle up.
var vertical = [ 0.0, 10.0, 0.0]; //the vertical direction ( 0,-1,0 the top is the floor).
@edwrodrig
edwrodrig / qt3to4.sh
Last active Aug 29, 2015
Scripts to convert qt3 files to qt4
View qt3to4.sh
for file in *.ui
do
filename="${file%.*}"
uic3 "$filename".ui > "$filename"4.h
uic3 -impl "$filename"4.h "$filename".ui > "$filename"4.cpp
done
View clustering
elems[] = [elem1, elem2, elem3, ..., elemn];
distances[][];
foreach (i < elems.size ) {
foreach ( j < elems.size ) {
distance[i][j] = distance(elem[i], elem[j]); // not all distances are needed, just triangle due distance conmuyativity
}
}
@edwrodrig
edwrodrig / dropbox_download.py
Created May 24, 2014
script for download files from dropbox dir
View dropbox_download.py
#!/usr/bin/python3
import urllib.request
import re
page = urllib.request.urlopen('https://www.dropbox.com/sh/0z53xjn04oxl2i5/XBWr22mJnR')
content = page.read()
urls = re.findall(r'filename-link.*?https://www\.dropbox\.com/(sh/0z53xjn04oxl2i5.*?\.flac)', content.decode())
for url in urls:
filename = re.search(r'[A-Za-z0-9-_%]*.flac',url).group(0)
print(filename)
@edwrodrig
edwrodrig / string_concat_test.cpp
Last active Aug 29, 2015
String concatenation benchmark in c++11
View string_concat_test.cpp
/*
Compile with:
g++ string_concat_test.cpp -o test -std=c++11
*/
#include <iostream>
#include <string>
#include <chrono>
#include <cstdlib>
#include <iomanip>
View deal_with_it_dijkstra.cpp
for ( int i = 0 ; i < 10 ; ++i )
for ( int j = 0 ; j < 10 ; ++j )
for ( int k = 0 ; k < 10 ; ++k )
if ( exitCondition ) goto stop;
stop:
View scenecontextmenuadapter.hh
#ifndef ___IMO_GRAPHICS_SCENECONTEXTMENUADAPTER_H___
#define ___IMO_GRAPHICS_SCENECONTEXTMENUADAPTER_H___
class QGraphicsSceneContextMenuEvent;
class QGraphicsItem;
namespace Imo {
namespace Graphics {
namespace SceneContextMenuAdapter {
You can’t perform that action at this time.