Skip to content

Instantly share code, notes, and snippets.

View lucindo's full-sized avatar

Renato Lucindo lucindo

  • São Paulo, Brazil
View GitHub Profile
@lucindo
lucindo / check_process.py
Last active February 16, 2016 01:09
sends a report of running process on servers
import sys
import subprocess
import smtplib
from email.mime.text import MIMEText
from threading import Thread
FROM = ""
TO = ""
SMTP_SERVER = "localhost"
@lucindo
lucindo / pure.theme.bash.diff
Created February 4, 2016 03:45
Showing virtualenv on Pure theme (bash it)
diff --git a/themes/pure/pure.theme.bash b/themes/pure/pure.theme.bash
index 9b145cc..c25c484 100644
--- a/themes/pure/pure.theme.bash
+++ b/themes/pure/pure.theme.bash
@@ -30,12 +30,13 @@ pure_prompt() {
ps_root="${red}\u${red}";
ps_root_mark="${red} # ${normal}"
ps_path="${yellow}\w${normal}";
+ ps_env="$(virtualenv_prompt)${normal}"
@lucindo
lucindo / README.md
Created November 6, 2015 14:09
Using Graphite/Grafana to gather Locust.io test data

Using Locust.io with Grafana

On your locust master server:

  • Install and configure Graphite. Follow a good tutorial
  • Install and configure Grafana: tutorial

Use logra.py on your locust test file. See locustfile.py.

import urllib, urllib2
import xml.etree.ElementTree as ET
from django.conf import settings
class PagSeguro():
def pagamento(self, item_id, item_descr, item_value):
pagseguro_url = 'https://ws.pagseguro.uol.com.br/v2/checkout/'
pagseguro_email = settings.PAGSEGURO_EMAIL
pagseguro_token = settings.PAGSEGURO_TOKEN
package netutil
import (
"encoding/json"
"io/ioutil"
"net/http"
)
func GetURLContents(url string) (contents []byte, err error) {
resp, err := http.Get(url)
# Simple Objective-C Makefile
bin = prog
CFLAGS = -Wno-import -Wall -O2
LDFLAGS = -lobjc -lm
src := $(wildcard *.m)
objects := $(foreach file, $(src), $(basename $(file)).o)
class MutexGuard
{
private:
Mutex & mutex_;
public:
MutexGuard(Mutex & mutex) : mutex_(mutex)
{
mutex_.aquire();
}
#lang racket
(define (pontos x)
(define (soma-lista x) (apply + x))
(define (strike? x) (= (length x) 1))
(define (spare? x) (= (soma-lista x) 10))
(define (pontos2 jogada-anterior jogadas)
;; devolve a proxima jogada, que pode ter um ou dois lances
(define (proxima-jogada)
(if (= (first jogadas) 10)
#include "Event.hh"
#include "TCPSocket.hh"
#include "TCPServer.hh"
#include <string>
#include <iostream>
class EchoSocket : public TCPSocket
{
public:
CXX = g++
CPPFLAGS = -Wall -ansi -O2
LDFLAGS = -lACE
bin = server client
cpps := $(wildcard *.cpp)
objects := $(foreach file, $(cpps), $(basename $(file)).o)
link_objects := $(filter-out $(foreach b, $(bin), $b.o), $(objects))
all: obj binaries