Skip to content

Instantly share code, notes, and snippets.

View flaviocdc's full-sized avatar

Flávio Coutinho da Costa flaviocdc

View GitHub Profile
@flaviocdc
flaviocdc / Program.cs
Last active January 23, 2026 06:11
Tool Enumeration Benchmark for MCP Servers - Parallel vs Sequential comparison
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.
using System.Diagnostics;
using Microsoft.Agents.A365.Tooling.Models;
using Microsoft.Agents.A365.Tooling.Services;
using Microsoft.Agents.Builder;
using Microsoft.Agents.Core.Models;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection;
@flaviocdc
flaviocdc / FinallyExample.java
Created November 10, 2014 20:00
Finally Example
public class FinallyExample {
public static void main(String[] args) {
System.out.println(foo("1"));
System.out.println(foo("a"));
}
public static int foo(String numStr) {
try {
int x = Integer.parseInt(numStr);
@flaviocdc
flaviocdc / plane_tickets.py
Created February 24, 2014 03:01
TalentBuddy Plane Tickets - too slow!
from bisect import bisect_left
def index(a, x):
'Locate the leftmost value exactly equal to x'
i = bisect_left(a, x)
if i != len(a) and a[i] == x:
return i
raise ValueError
def get_journey(departure_ids, destination_ids):
@flaviocdc
flaviocdc / tuple_sum.py
Created February 23, 2014 01:48
TalentBuddy.co Tuple Sum using DFS
def tuple_sum(a, s):
ret = backtrack(a, s, 0, 1, 2, 3)
print ' '.join(str(i) for i in ret)
def backtrack(a, s, x, y, w, z):
result = a[x] + a[y] + a[w] + a[z]
conj = set([x, y, w, z])
if result == s and len(conj) == 4:
@flaviocdc
flaviocdc / firewall.py
Created January 31, 2014 14:25
Working IPTables NAT QEMU hook
#!/usr/bin/env python
import sys
import os
import errno
from time import sleep
FIFO_PATH = "/etc/scripts/ipc"
MESSAGE="libvirtd-restart\n"
SLEEP_SECS=2
@flaviocdc
flaviocdc / przombie.c
Last active December 30, 2015 06:09
Trabalho 5 de SO2
#include <sys/types.h>
#include <dirent.h>
#include <stdio.h>
#include <stdlib.h>
#include <errno.h>
#include <sys/stat.h>
#include <string.h>
#include <stdbool.h>
#include <unistd.h>
#include <signal.h>
package com.brauto.automacao.device.usb;
import android.app.Service;
import android.content.Intent;
import android.os.Handler;
import android.os.IBinder;
import android.util.Log;
import com.brauto.automacao.MyApp;
import com.googlecode.androidannotations.annotations.EService;
int led = 13;
int incomingByte = 0;
// the setup routine runs once when you press reset:
void setup() {
// initialize serial communication at 9600 bits per second:
Serial.begin(9600);
pinMode(led, OUTPUT);
}
Index: src/test/br/ufrj/gnosys/framework/mock/FakeLogin.java
===================================================================
--- src/test/br/ufrj/gnosys/framework/mock/FakeLogin.java (revision 3079)
+++ src/test/br/ufrj/gnosys/framework/mock/FakeLogin.java (working copy)
@@ -1,15 +1,23 @@
package br.ufrj.gnosys.framework.mock;
+import java.util.HashSet;
+
+import javax.persistence.EntityManager;
@flaviocdc
flaviocdc / palavras-lidas-v1.py
Created September 23, 2013 03:40
Palavras Lidas
pop=list(raw_input("digite uma palavra: "))
print len(pop),"numero de caracteres da palvra"
print pop[0],"e a primeira letra da plavra"
print pop[-1],"e a ultima letra da palavra"
for i in range(len(pop)):
caracter = pop[i]
if caracter == 'a' or caracter == 'e' or caracter == 'i' or caracter == 'o' or caracter == 'u':
pop[i] = ' '