Skip to content

Instantly share code, notes, and snippets.

View mrother's full-sized avatar
🤓
Old but gold...

Mauricio Rother mrother

🤓
Old but gold...
View GitHub Profile
@mrother
mrother / kafka-cheat-sheet.md
Created August 23, 2023 19:47 — forked from sahilsk/kafka-cheat-sheet.md
Apache Kafka Cheat Sheet

Kafka Cheat Sheet

Display Topic Information

$ kafka-topics.sh --describe --zookeeper localhost:2181 --topic beacon
Topic:beacon	PartitionCount:6	ReplicationFactor:1	Configs:
	Topic: beacon	Partition: 0	Leader: 1	Replicas: 1	Isr: 1
	Topic: beacon	Partition: 1	Leader: 1	Replicas: 1	Isr: 1
@mrother
mrother / Reclaim VHDX Space.txt
Last active January 15, 2023 16:06
Reclaim WSL2 VHDX disk space
Path to WSL2 VHD:
C:\Users\<user>\AppData\Local\Packages\CanonicalGroupLimited.UbuntuonWindows_79rhkp1fndgsc\LocalState
or
%appdata%\..\Local\Packages\CanonicalGroupLimited.UbuntuonWindows_79rhkp1fndgsc\LocalState
wsl --shutdown
diskpart
# open window Diskpart
select vdisk file=".\ext4.vhdx"
attach vdisk readonly
@mrother
mrother / pair-dual-boot-bluetooth.md
Created January 2, 2023 18:39 — forked from madkoding/pair-dual-boot-bluetooth.md
Pairing bluetooth devices (keyboard or mouse) in dual boot with Linux Ubuntu and Windows 10

1) Pair ALL bluetooth devices in linux (it is to have the files you will need to edit later)

2) Pair ALL bluetooth devices in Windows 10. If you know how, get the MAC address id from your bluethooth keyboard, we will need it later

3) Reboot and go back to Linux

4) Install chntpw package, this is needed to read the registry keys from Wintendo

sudo apt-get install chntpw
@mrother
mrother / example.md
Created February 26, 2021 00:31 — forked from devdrops/example.md
Mysqldump from Docker container

Mysqldump from Docker container

docker exec -i mysql_container mysqldump -uroot -proot --databases database_name --skip-comments > /path/to/my/dump.sql

OBS

  • This will generate a dump.sql file in your host machine. Awesome, eh?
  • Avoid using --compact on your dump. This will make MySQL check your constraints which will cause troubles when reading your file (damm you MySQL). And don't use --force to fix this scenario: recreate your dump without --compact ¯_(ツ)_/¯
@mrother
mrother / clean_code.md
Created October 9, 2020 01:27 — forked from wojteklu/clean_code.md
Summary of 'Clean code' by Robert C. Martin

Code is clean if it can be understood easily – by everyone on the team. Clean code can be read and enhanced by a developer other than its original author. With understandability comes readability, changeability, extensibility and maintainability.


General rules

  1. Follow standard conventions.
  2. Keep it simple stupid. Simpler is always better. Reduce complexity as much as possible.
  3. Boy scout rule. Leave the campground cleaner than you found it.
  4. Always find root cause. Always look for the root cause of a problem.

Design rules

@mrother
mrother / .htaccess
Created March 23, 2019 00:39 — forked from vielhuber/.htaccess
Apache: htaccess force www and https ssl #server
# force HTTPS and www.
RewriteEngine On
RewriteCond %{HTTP_HOST} (?!^www\.)^(.+)$ [OR]
RewriteCond %{HTTPS} off
RewriteRule ^ https://www.%1%{REQUEST_URI} [R=301,L]
# alternative way
RewriteCond %{HTTP_HOST} !^$
RewriteCond %{HTTP_HOST} !^www\. [NC]
@mrother
mrother / bovespa.py
Created November 24, 2018 10:07 — forked from turicas/bovespa.py
Get stock prices from BMF Bovespa API
# coding: utf-8
# Copyright 2015 Álvaro Justen <https://github.com/turicas/rows/>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
@mrother
mrother / form.html
Last active September 9, 2018 00:19 — forked from aaronvanston/form.html
Bootstrap 4 + Parsley JS
$("#parsleyForm").parsley({
errorClass: 'has-danger',
successClass: 'has-success',
classHandler: function(ParsleyField) {
return ParsleyField.$element.parents('.form-group');
},
errorsContainer: function(ParsleyField) {
return ParsleyField.$element.parents('.form-group');
},
errorsWrapper: '<span class="text-help">',
@mrother
mrother / view_cart.html
Created August 11, 2018 00:10 — forked from onefriendaday/view_cart.html
Pagseguro checkout transparent
<script type="text/javascript" src="https://stc.pagseguro.uol.com.br/pagseguro/api/v2/checkout/pagseguro.directpayment.js"></script>
<script type="text/javascript">
var paymentModule = 'pagseguro_app';
checkoutCallbacks.add(pagseguroCheckout);
function pagseguroCheckout() {
if ($('input[name=module]').val() == paymentModule) {
@mrother
mrother / select-estados-br
Created July 31, 2018 19:06 — forked from cassiocardoso/select-estados-br
Select com uma lista de todos os estados brasileiros.
<select name="estados-brasil">
<option value="AC">Acre</option>
<option value="AL">Alagoas</option>
<option value="AP">Amapá</option>
<option value="AM">Amazonas</option>
<option value="BA">Bahia</option>
<option value="CE">Ceará</option>
<option value="DF">Distrito Federal</option>
<option value="ES">Espírito Santo</option>
<option value="GO">Goiás</option>