Skip to content

Instantly share code, notes, and snippets.

View rafael-garcia's full-sized avatar

Rafael Matheus Garcia rafael-garcia

View GitHub Profile
void rotina (int n, int* v) {
int i, temp;
int troca = 0;
for (i=0; i < n-1; i++)
if (v[i] > v[i+1]) {
temp = v[i];
v[i] = v[i+1];
v[i+1] = temp;
troca = 1;
}
@rafael-garcia
rafael-garcia / rg.s
Last active March 31, 2018 23:08
ROT p1 2017
main:
# n = 6
addi $s0, $zero, 6
# por padrao registradores $aX guardam os params
add $a0, $s0, $zero
# chama rotina
jal ROT
#!/bin/bash
fontc=`tput setab 0` # black
back=`tput setaf 2` # green
delim=" %%% "
ColEcho() {
echo "$(tput setab 3)$(tput setaf 4)${delim}${fontc}$1${back}$(tput setab 3)$(tput setaf 4)${delim}"
}
// Load the TCP Library
net = require('net');
// Keep track of the chat clients
var clients = [];
// Start a TCP Server
net.createServer(function (socket) {
// Identify this client