Skip to content

Instantly share code, notes, and snippets.

View marcelomf's full-sized avatar

Marcelo Fleury marcelomf

View GitHub Profile
@marcelomf
marcelomf / geradados.php
Created September 18, 2013 15:32
Simple codes for stress testing
#!/usr/bin/php
<?php
// timestamp, router, ip src, ip dst, proto, port src, port dst, bsize
$routers = array("cisco", "juniper", "linux", "freebsd", "openbsd");
$ips = array("192.168.0.1", "192.168.0.2", "192.168.0.3", "192.168.0.4", "192.168.0.5", "192.168.0.6", "200.123.321.2", "200.123.321.1");
$protos = array("udp", "tcp", "icmp");
$apps = array("22","80","21","8080","443");
//http://kb.juniper.net/InfoCenter/index?page=content&id=KB14737
const MTU_SIZE = 1500;
// 86400 == 1day/s 3600 == 1hr/s; 1488095 == max packets/s in 1GB
@marcelomf
marcelomf / event.js
Last active December 23, 2015 16:59
GraoEvent
// Glocal Scope :)
var styles,
states,
generator,
logger,
handle;
var service = {
push: function()
{
@marcelomf
marcelomf / Inject.js
Created April 3, 2014 12:30
NodeJS Dependency Injection Test
var Inject = function(){
this.teste = function() {
//console.log("teste");
return 1+1;
}
this.teste2 = function() {
var a = 1,b = 2,c = 3,d = 4,e = 5;
a += b;
a += b;
@marcelomf
marcelomf / express.js
Created April 9, 2014 19:00
Promise and "race conditions"
var Q = require("q");
var _ = require("lodash");
function promise(data){
var def = Q.defer();
var saveData = data;
//var saveData = _.cloneDeep(data);
console.log(saveData);
setTimeout(function(){
@marcelomf
marcelomf / .vimrc
Last active August 29, 2015 14:14
dotvimrc
" Vundle required
set nocompatible
filetype off
set rtp+=~/.vim/bundle/Vundle.vim
call vundle#begin()
" alternatively, pass a path where Vundle should install plugins
"call vundle#begin('~/some/path/here')
" let Vundle manage Vundle, required
Plugin 'gmarik/Vundle.vim'
@marcelomf
marcelomf / postinstall.sh
Last active August 29, 2015 14:15
Post install debian like
#!/bin/bash
apt-get update && apt-get upgrade -y
apt-get -y install docker.io vim git firefox
apt-get -y install php5 ruby python3 nodejs gcc g++ clang golang make cmake build-essential python-dev exuberant-ctags sshm terminator wget lynx links curl
apt-get -y install python3-pip gem npm php-pear software-properties-common python3-software-properties
gem install bundler
apt-get -y install etherape wireshark nmap hping3 dsniff packit ettercap-common netcat tcpdump whois traceroute tcptraceroute
#apt-get -y install ffmpeg gstreamer0.10-ffmpeg
apt-get -y install flashplugin-installer openshot terminator gnupg2 tcplay vlc inkscape pencil pinta calibre thunderbird midori dia unrar conky keepass2 lm-sensors gedit cheese unrar p7zip-full libc-bin wine libav-tools freemind
@marcelomf
marcelomf / virtnet.sh
Last active August 29, 2015 14:21
virtnet.sh
#!/bin/bash
# @author Marcelo Machado Fleury <marcelomf@gmail.com>
# @date 21/05/2015
# Other tools: pimd mrouted xorp igmpproxy dnsmasq
# printf 'DE:AD:BE:EF:%02X:%02X\n' $((RANDOM%256)) $((RANDOM%256))
multicasts=( "239.255.255.250" "224.0.0.1" "224.0.0.2" "224.0.1.1" "224.0.0.9" "224.0.1.2" "224.0.0.0" "224.0.1.0" "224.0.2.0" "224.1.0.0" "224.2.0.0" "224.3.0.0" "224.5.0.0" "225.0.0.0" "232.0.0.0" "233.0.0.0" "233.252.0.0" "234.0.0.0" "239.0.0.0" )
#echo $(basename "$0")
script_name=$(readlink -f $(dirname ${BASH_SOURCE[0]}))"/"$(basename "$(test -L "$0" && readlink "$0" || echo "$0")")
@marcelomf
marcelomf / nginx
Created April 30, 2018 13:01
nginx php lumen
server {
listen 80 default_server;
listen [::]:80 default_server;
root /home/marcelo/projetos/restful-orm/lumen/public;
index index.php index.html index.htm index.nginx-debian.html;
server_name lumen.teste;
location ~ \.php$ {
@marcelomf
marcelomf / functions.js
Created November 7, 2018 15:14
Funções javascript
var retornaDadosSync = function(){
return {nome: "marcelo", idade: 32}
}
var retornaDadosASync = function(callback){
setTimeout(function(){
return callback({nome: "marcelo", idade: 32})
}, 3000)
}
@marcelomf
marcelomf / funcstions2.js
Last active January 16, 2019 11:50
Teste
const funcao1 = function(id){
return {nome: "João", idade: 32, id: id}
}
const funcao2 = function(callback, id){
setTimeout(function(){
return callback({nome: "João", idade: 32, id: id})
}, 3000)
}