Skip to content

Instantly share code, notes, and snippets.

@allanjos
allanjos / golang-tips.md
Last active November 20, 2020 00:12
Golang tips
@allanjos
allanjos / git-rewrite-old-commits.txt
Created April 25, 2019 17:50
GIT - Rewrite old commits to add signature
git filter-branch --msg-filter "cat - && echo && echo 'Signed-off-by: <USERNAME> <<EMAIL>>'" HEAD~3..HEAD
@allanjos
allanjos / freebsd-get-deps.sh
Created December 18, 2018 02:37
FreeBSD dependencies from package
for f in `ldd jsonc-test | grep '=>' | sed $'s/\t//g' | sed 's/.*=> *//g' | sed 's/(.*//g'`; do echo $f; pkg which $f; done | grep 'was installed by' | sed 's/.*was installed by package *//g'
@allanjos
allanjos / json-parse-test.c
Last active December 18, 2018 02:15
json-c parse
#include <json-c/json.h>
#include <stdio.h>
const char *json_get_type_name(enum json_type type);
void json_parse_object(json_object *jobj);
void json_parse_array(json_object *jobj, char *key);
void json_print_value(json_object *jobj);
const char *json_get_type_name(enum json_type type)
{
@allanjos
allanjos / base64-test.c
Last active December 17, 2018 19:19
libbase64 usage
#include <iostream>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#define BUFFERSIZE 1024
#include <b64/encode.h>
#include <b64/decode.h>
@allanjos
allanjos / mongodb-build-sample-fedora.txt
Last active November 28, 2018 05:02
MongoDB build sample - Fedora
$ sudo dnf install mongodb mongodb-server
$ sudo dnf install mongo-c*driver
$ sudo dnf install mongo-c*driver-devel
$ sudo dnf install mongodb*devel
$ sudo dnf install mongo*devel
$ sudo dnf install mongodb*devel
$ sudo dnf install mongo-c*driver-devel
$ sudo dnf install libmongo-client.x86_64
$ sudo dnf install mongo-c-driver.x86_64
@allanjos
allanjos / wxwidgets-build.md
Last active November 7, 2018 14:58
wxWidgets - Build

Settings used for wxWidgets projects.

Linux

Clone source tree

cd <WXWIDGETS_SRC_DIR>

mkdir trunk; mkdir build
@allanjos
allanjos / ids-stream-freebsd.md
Last active August 5, 2020 16:46
IDS on FreeBSD

IDS

Flow of communication

snort -> syslog -> kafka

SYSLOG

Add to /etc/rc.conf:

@allanjos
allanjos / java-development-environment.md
Last active November 5, 2018 00:40
Java development environment

Java development environment

JEE APP BUILD (TOMCAT)

Environment definitions:

SET CATALINA = <Apache Tomcat installation directory>

SET CLASSPATH = %CATALINA%\lib\jsp-api.jar;%CATALINA%\lib\servlet-api.jar;%CLASSPATH%
@allanjos
allanjos / pyqt-windows.md
Last active November 5, 2018 00:37
PyQT on Windows

Install Python from: https://www.python.org/downloads/windows/

Install PyQt using pip:

pip3 install PyQt5

Create a file with the following code:

from PyQt5.QtWidgets import QApplication, QWidget, QPushButton, QVBoxLayout

app = QApplication([])