Skip to content

Instantly share code, notes, and snippets.

View albertogviana's full-sized avatar

Alberto Guimarães Viana albertogviana

View GitHub Profile
@albertogviana
albertogviana / ReadBigFileAndParse.go
Created July 12, 2022 18:30 — forked from rodkranz/ReadBigFileAndParse.go
Read big file and unmarshal in json
// Package main
// Copyright 2017 Kranz. All rights reserved.
// Use of this source code is governed by a MIT-style
// license that can be found in the LICENSE file.
/**
Test read file by chunks
➜ read ll
total 13241936
drwxr-xr-x 5 rlopes staff 170B 16 Jan 01:19 ./
@albertogviana
albertogviana / nginx-alertmanager-prometheus
Created August 12, 2019 11:48
Nginx reverse proxy for Prometheus and Alertmanager
upstream @prometheus {
server MY_IP:9090;
}
upstream @alertmanager {
server MY_IP:9093;
}
server {
listen 80;
@albertogviana
albertogviana / TunnelClient.java
Last active December 1, 2022 18:10 — forked from denis-kalinin/TunnelClient.java
Using Apache MINA to create SSL/TLS connection with client certificate
import org.apache.mina.filter.ssl.SslFilter;
import org.apache.mina.transport.socket.nio.NioSocketConnector;
public class TunnelClient{
.......
NioSocketConnector nioConnector = new NioSocketConnector(1);
nioConnector.setDefaultRemoteAddress(tunnelServerAddress);
nioConnector.setHandler(handler);
SslFilter sslFilter = new SslFilter(getSSLContext());
@albertogviana
albertogviana / clean-up-boot-partition-ubuntu.md
Created October 1, 2018 10:54 — forked from ipbastola/clean-up-boot-partition-ubuntu.md
Safest way to clean up boot partition - Ubuntu 14.04LTS-x64

Safest way to clean up boot partition - Ubuntu 14.04LTS-x64

Reference

Case I: if /boot is not 100% full and apt is working

1. Check the current kernel version

$ uname -r 
@albertogviana
albertogviana / kafka-cheat-sheet.md
Created July 11, 2018 09:27 — forked from ursuad/kafka-cheat-sheet.md
Quick command reference for Apache Kafka

Kafka Topics

List existing topics

bin/kafka-topics.sh --zookeeper localhost:2181 --list

Describe a topic

bin/kafka-topics.sh --zookeeper localhost:2181 --describe --topic mytopic

Purge a topic

bin/kafka-topics.sh --zookeeper localhost:2181 --alter --topic mytopic --config retention.ms=1000

... wait a minute ...

@albertogviana
albertogviana / access-control.json
Created October 17, 2017 12:07
Script to grant users permissions on Jenkins. You need to install matrix-auth if you want to use it
{
"users":[
{
"username": "user1",
"role": "master"
},
{
"username": "user2",
"role": "master"
},
upstream @admin {
server my-ip1:8081;
server my-ip2:8081;
}
server {
listen 80;
listen [::]:80;
server_name www.cliente2.com.br;
return 301 https://$server_name$request_uri;
@albertogviana
albertogviana / compress_files.sh
Last active August 22, 2016 12:03
Read a directory and compress files
#!/bin/bash
path=${1}
glob_filename=${2}
if [ ! ${path} ] || [ ! ${glob_filename} ]
then
echo "This script will compress files using zip.
To use this script you need to inform the directory path and the file

Keybase proof

I hereby claim:

  • I am albertogviana on github.
  • I am albertogviana (https://keybase.io/albertogviana) on keybase.
  • I have a public key whose fingerprint is 08AC 8008 90C1 4B39 DF0B 89B6 A3F2 A295 6907 EE69

To claim this, I am signing this object:

<?php
namespace User\Entity;
use Doctrine\ORM\Mapping as ORM;
use ZfcUser\Entity\UserInterface;
use Rbac\Identity\IdentityInterface;
use Doctrine\Common\Collections\ArrayCollection;
/**