Skip to content

Instantly share code, notes, and snippets.

View jcbf's full-sized avatar

José Borges Ferreira jcbf

  • AnubisNetworks
  • Lisbon, Portugal
View GitHub Profile
@jcbf
jcbf / run.sh
Created July 17, 2020 14:27
bash timeout
./run.sh 10 slow_command
./run.sh 3 sleep 5
docker container run --mount type=tmpfs,destination=/tmp -p 10050:10050 -d --name olefy a16bitsysop/olefy
(
echo -ne "OLEFY/1.0\nMethod: oletools\nRspamd-ID: asad\n\n"
cat /tmp/qq/Qx.7475.xls
) | nc -w5 127.0.0.1 10050 | jq .
@jcbf
jcbf / get costs from ec2instances.info
Last active May 8, 2020 05:07
get aws instance name and type
curl https://raw.githubusercontent.com/powdahound/ec2instances.info/master/www/instances.json | jq -r ' .[] | [ .instance_type , .pricing."eu-west-1".linux.ondemand , .pricing."eu-west-1".linux.reserved."yrTerm1Convertible.noUpfront"] | @csv' > prices.csv
head prices.csv
"c5d.xlarge","0.218","0.173"
"m5a.2xlarge","0.384","0.311"
"c5.9xlarge","1.728","1.369"
"m5.24xlarge","5.136","4.147"
"i3en.12xlarge","6","4.721"
"m5d.12xlarge","3.024","2.445"
"c5.large","0.096","0.076"
curl -Ns https://ip-ranges.amazonaws.com/ip-ranges.json | jq '.prefixes | .[] | select(.region == "eu-west-1")| .ip_prefix '
# ldiff parsing
perl -p0e 's/\n //g' dump.ldif
@jcbf
jcbf / backup_pf_queue.sh
Last active October 1, 2017 20:41
Copy postfix queue to another server
# http://postfix.1071664.n5.nabble.com/stop-receiving-mail-but-keep-processing-mail-in-queue-td92652.html#a92762
# : on old server
service pf_outb_deliver stop
export MAIL_CONFIG=/opt/config/pf_outb_deliver
name=$(postconf -xh syslog_name)
postsuper -h ALL
cd $(postconf -xh queue_directory)
@jcbf
jcbf / post-commit-jira.sh
Last active September 29, 2017 18:36
Post commit host to update JIRA from SVN
#!/bin/sh
# Author: Jose Ferreira based on Carlo Sciolla <carlo@backbase.com> script
# Revision: 0.1
USER="username"
PASS="xxxxxxxxx"
JIRA="https://blabla.atlassian.net"
REPO=$1
@jcbf
jcbf / lambda.py
Last active October 20, 2020 08:26
Make queries to Elasticsearch from a lambda in python
# Run get info from Elasticsearch from AWS Lambda.
from __future__ import print_function
import boto3
import certifi
import yaml
from aws_requests_auth.aws_auth import AWSRequestsAuth
from elasticsearch import Elasticsearch, RequestsHttpConnection
def handler(event, context):
@jcbf
jcbf / install ssdeep perl.sh
Last active May 6, 2019 15:48
perl ssdeep
git clone https://github.com/hideo55/Data-FuzzyHash.git
sudo aptitude install libfuzzy-dev
cd Data-FuzzyHash/
cpanm --sudo Module::Build::XSUtil
# handle \0 in buffer
# diff --git a/xs/FuzzyHash.xs b/xs/FuzzyHash.xs
#index 272d2aa..21da3e2 100644
#--- a/xs/FuzzyHash.xs
#+++ b/xs/FuzzyHash.xs