Skip to content

Instantly share code, notes, and snippets.

View locks's full-sized avatar
🌟
Ember Polaris

Ricardo Mendes locks

🌟
Ember Polaris
View GitHub Profile
@locks
locks / exame_ex_1.s
Created February 7, 2009 19:04
Exame Modelo, prática (ARQCP)
; ESTÁ AINDA UM BOCADO INCOMPLETO, nomeadamente faltam preencher rotinas xD
.file "exame_1.s"
.include "lib/auxil.s"
.include "lib/Biblioteca1.s"
.org 0x1000
br inicio
difHora::
@locks
locks / prática (IGNITE)
Created February 9, 2009 02:30
resumos (ARQCP)
Declaração de variáveis
var_long:: .long 12315
var_word:: .word 342
var_byte:: .byte 4
var_string:: .byte "afbad",0
.space.b <espaço>
var_vector:: .<long/word/byte> 2646,24,62476,246
.space.<l/w/b> <espaço>
var_matriz:: .<long/word/byte> 23425,245624525,245,2
.space.<l/w/b> <espaço>
@locks
locks / reflex.sh
Created March 3, 2009 21:25
LPROG, lazy scripts O:-)
#!/bin/bash
function runFlex {
echo $ficheiro
flex="$ficheiro.c"
gcc="$ficheiro.out"
flex -o $flex $ficheiro
gcc -o $gcc $flex -lfl
./$gcc
@locks
locks / eleitor.c
Created April 28, 2009 17:57
Ficha de Avaliação n.º 2 (ScOMP)
#include <unistd.h>
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <sys/types.h>
#include <sys/ipc.h>
#include <sys/shm.h>
#include "semaforos.h"
@locks
locks / app.rb
Created June 25, 2009 01:12
Simple webserver
require 'rubygems'
require 'sinatra'
require 'haml'
require 'sass'
set :port, 8080
#set :views, File.expand_path(File.dirname(__FILE__) + '/')
set :public, File.dirname(__FILE__)
get '/' do
require 'rubygems'
require 'savon'
require 'sinatra'
#Savon::SOAP.version = 2
servico = "http://dot.dei.isep.ipp.pt/060516/dir3/srvARQSI45.asmx?wsdl"
get '/' do
client = Savon::Client.new servico
@locks
locks / lv1
Created December 17, 2009 02:15
string::split c++
vector<string> split(const string& s)
{
vector<string> ret;
typedef string: ize_type string_size;
string_size i = 0;
// invariant: we have processed characters [original value of i, i)
while (i != s.size()) {
// ignore leading blanks
// invariant: characters in range [original i, current i) are all spaces
@locks
locks / Toolkit.h
Created December 19, 2009 02:56
CLIT (C++ Library Is a Toolkit)
namespace clit {
int stringToInt(string argumento) {
istringstream str(argumento);
int x;
return (str>>x) ? x : -1;
}
template <class T>
@locks
locks / README.md
Created December 27, 2009 23:15
Mergesort implementation
@locks
locks / mongo.rb
Created January 2, 2010 13:35
MongoDB experiments
require 'rubygems'
require 'mongo_mapper'
class Subject
include MongoMapper::EmbeddedDocument
key :nome, String
key :ano, Integer
end