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 <iostream> | |
void | |
insertion(int v[], int size) | |
{ | |
int aux; | |
for(int i = 0; i < size-1; i++) { | |
for(int j = i+1; j >= 0 && v[j] < v[j-1]; j--) { | |
aux = v[j-1]; | |
v[j-1] = v[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
#include <iostream> | |
void | |
bubble(int v[], int size) | |
{ | |
for(int i = size-1; i >= 1; i--) { | |
int aux; | |
for(int j = i; j >= 0; j--) { | |
if(v[i] < v[j]) { | |
aux = v[i]; |
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
func (a *App) MarshalJSON() ([]byte, error) { | |
var result map[string]interface{} | |
result["name"] = a.Name | |
result["state"] = a.State() | |
result["platform"] = a.Platform | |
... | |
return json.Marshal(result) | |
} |
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
// changes the data in db.collection[from] to | |
// db.collection[to] and deletes db.collection[from] | |
// how can I force the execution of the variables from and to? | |
function changeFieldKey(collection) { | |
var docs = db[collection].find({"from-key": {$exists: true}}); | |
for (var i = 0; i < docs.length(); i++) { | |
print(docs[i]) | |
docs[i]["to-key"] = docs[i]["from-key"]; | |
delete docs[i]["from-key"]; | |
print(docs[i]) |
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
package main | |
import ( | |
"os" | |
"syscall" | |
"time" | |
) | |
func main() { | |
f, err := os.OpenFile("/Users/f/txaws.diff", syscall.O_RDONLY|syscall.O_EXLOCK, 0644) |
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
=== modified file 'terminal.go' | |
--- terminal.go 2012-02-21 18:47:37 +0000 | |
+++ terminal.go 2012-08-31 16:29:38 +0000 | |
@@ -5,9 +5,7 @@ | |
package rietveld | |
import ( | |
- "io" | |
- "syscall" | |
- "unsafe" |
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
#--- PYTHON IMPORTS | |
import math | |
from datetime import datetime, date | |
#--- DJANGO IMPORTS | |
from django.db import models | |
from django.db.models import Avg | |
from django.contrib.auth.models import User | |
from django.core.urlresolvers import reverse | |
from django.template.defaultfilters import slugify |
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
diff -ru a/boto/connection.py b/boto/connection.py | |
--- a/boto/connection.py 2012-11-29 14:04:38.000000000 -0200 | |
+++ b/boto/connection.py 2012-11-29 11:51:16.000000000 -0200 | |
@@ -658,7 +658,7 @@ | |
return self.new_http_connection(host, is_secure) | |
def new_http_connection(self, host, is_secure): | |
- if self.use_proxy: | |
+ if self.use_proxy and not is_secure: | |
host = '%s:%d' % (self.proxy, int(self.proxy_port)) |
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 <stdio.h> | |
#include <stdlib.h> | |
#include <cuda.h> | |
void | |
checkError(cudaError_t err, int line) | |
{ | |
if(err != cudaSuccess) { | |
printf("%s in %s at line %d\n", cudaGetErrorString(err), __FILE__, line); | |
exit(EXIT_FAILURE); |
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 <stdio.h> | |
#include <stdlib.h> | |
#include <string.h> | |
struct substring | |
{ | |
char *inner; | |
int lower, upper; | |
}; |