Skip to content

Instantly share code, notes, and snippets.

View pmarques's full-sized avatar

Patrick Marques pmarques

  • Proofpoint
  • London
View GitHub Profile
@pmarques
pmarques / asyncsrv.pl
Created July 15, 2011 09:19
resolve asyncsrv.pl issue, the original example doesn't work!
60c59,69
< zmq.device(zmq.QUEUE, frontend, backend)
---
> while True:
> sockets = dict(poll.poll())
> if frontend in sockets:
> if sockets[frontend] == zmq.POLLIN:
> msg = frontend.recv()
> print 'Server received %s' % (msg)
> backend.send(msg)
@pmarques
pmarques / site 24x7 scraper
Created March 24, 2014 18:13
Print in browser console the ordered result of a scan in a table
var DEBUG = false;
// XPath Selector
var $x = function (path) {
var r = document.evaluate(path, document, null, 9, null).singleNodeValue
return !!r ? [r] : [];
};
var values = [];
@pmarques
pmarques / amazon_bulk _download.js
Created January 20, 2016 13:48
Amazon Cloud Drive multiple files download
/**
* Open Amazon Cloud Drive folder and run this script to download all the files in the folder.
*/
var items = document.getElementsByClassName('item');
var i;
var url
var urls = []
for(i = 0; i < items.length; ++i) {
@pmarques
pmarques / .bash_node_v
Last active August 16, 2016 10:14
Simple Node version control
# How to use it
# copy the code into .bashrc our download the .bash_node_v file into your home
# and add to your .bashrc or .bash_profile:
# source .bash_node_v
#
# Configure it creating a .nrc (in your home or in the same folder you put this file) and add
# the folder where you want to install the node versions, for instance:
# NODE_PREFIX="/Software/node/"
#
---
- name: "Always tag shoudld not run if condition fails"
hosts: localhost
gather_facts: no
tasks:
- debug: msg="This should run"
tags:
- always
Fri Nov 18 16:27:25 UTC 2016
@pmarques
pmarques / session.go
Created December 7, 2016 15:19 — forked from jochasinga/session.go
Example of middlewares in Go
package main
import (
"log"
"strings"
)
type Session struct {
Email string
Password string
@pmarques
pmarques / awslogs.service
Last active April 10, 2017 15:25
SytemD AWS logs service (AWS seems to not support it officially)
[Unit]
Description=CloudWatch Logs agent
After=network.target
[Service]
Restart=always
TimeoutSec=infinity
ExecStart=/var/awslogs/bin/awslogs-agent-launcher.sh
[Install]
@pmarques
pmarques / TG784n_firewall.sh
Created April 19, 2017 16:00
Configure TG784n v3 IPv6 firewall
#!/usr/bin/expect
set timeout 20
set host [lindex $argv 0]
set user [lindex $argv 1]
set pass [lindex $argv 2]
set ipv6 [lindex $argv 3]
set chainName "Advanced"
spawn telnet $host
@pmarques
pmarques / print_installed_packages.py
Last active June 5, 2017 09:05
Lambda function to print python installed packages
import pip
def lambda_handler(event, context):
installed_packages = pip.get_installed_distributions()
installed_packages_list = sorted(["%s==%s" % (pkg.key, pkg.version) for pkg in installed_packages])
print("\n".join(installed_packages_list))