This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# -*- encoding: utf-8 -*- | |
# RESTFul api test for blog post | |
# Author: Sérgio Berlotto <[email protected]> | |
# Site: http://blog.programadorlivre.com | |
# restapi.py | |
import falcon | |
try: | |
import ujson as json | |
except Exception, e: | |
import json |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# -*- encoding: utf-8 -*- | |
# RESTFul api test for blog post | |
# Author: Sérgio Berlotto <[email protected]> | |
# Site: http://blog.programadorlivre.com | |
# restapi-db.py | |
TOTAL_FRASES = 1000 | |
DBNAME = "restapi" | |
TABLENAME = "frases" | |
HOST = "localhost" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# -*- encoding: utf-8 -*- | |
# RESTFul api test for blog post | |
# Author: Sérgio Berlotto <[email protected]> | |
# Site: http://blog.programadorlivre.com | |
# restapi.py | |
import falcon | |
try: | |
import ujson as json | |
except Exception, e: | |
import json |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#http://wyattbaldwin.com/2014/01/09/generating-random-tokens-in-python/ | |
import os | |
import hashlib | |
print hashlib.sha1(os.urandom(128)).hexdigest() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#-*- coding: utf-8 -*- | |
import os | |
import sys | |
import resource | |
def create_daemon(stdout, stderr, working_dir): | |
""" | |
cria um daemon | |
""" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#Faz 10000 requisições com 100 usuários em parelelo/concorrência | |
ab -n 10000 -c 100 http://localhost/ | |
#http://httpd.apache.org/docs/2.0/programs/ab.html |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
VERSION="0.1" | |
IDENT="latest" | |
if [ $# -lt 2 ] ; then | |
printf "getgidiff - created by [email protected]\n" | |
printf "Version:$VERSION\n" | |
printf "Usage:\n\tgetgitdiff {earlier-commit} {some-commit} [package-identification]\n" | |
exit 1; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#Listar as virtual machines | |
virsh list --all | |
#Iniciar máquina virtual | |
virsh start Guest | |
#Abrir o visualizador gráfico da máquina virtual | |
virt-viewer Guest | |
#DEsligar a máquina forçado |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
gksudo gedit /etc/libvirt/qemu/<your-disk-name>.xml | |
Find and change the path: | |
<source file='/home/connor/ubuntu-kvm/<your-disk-name>.qcow2'/> | |
mv ~/<your-disk-name>.qcow2 ~/VirtualMachines/. | |
restart the libvirt service | |
sudo /etc/init.d/libvirt-bin restart |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# | |
# ~/.bashrc | |
# | |
# If not running interactively, don't do anything | |
[[ $- != *i* ]] && return | |
alias ls='ls --color=auto' | |
PS1='[\u@\h \W]\$ ' |