Skip to content

Instantly share code, notes, and snippets.

@marc-queiroz
marc-queiroz / mysql-docker.sh
Created November 23, 2021 14:11 — forked from spalladino/mysql-docker.sh
Backup and restore a mysql database from a running Docker mysql container
# Backup
docker exec CONTAINER /usr/bin/mysqldump -u root --password=root DATABASE > backup.sql
# Restore
cat backup.sql | docker exec -i CONTAINER /usr/bin/mysql -u root --password=root DATABASE
@marc-queiroz
marc-queiroz / Tutorial_VOSViewer_CitNetExplorer.md
Last active April 26, 2021 14:39
Tutorial para VOSViewer e CitNetExplorer - Bibliometria

VOSViewer

Primeiramente é necessário fazer o download da aplicação.

VOSViewer

Para utilizar a aplicação é necessário Criar um mapa basead em texto. Para produzir esse texto é necessário um conjunto de artigos científicos, nos quais serão representados pelo seu título.

Além dos títulos de todos os artigos que você deseja mapear usando o VOSViewer é necessário ter acesso a plataforma Web of Science

@marc-queiroz
marc-queiroz / DatabaseDemo.js
Created February 17, 2021 19:10
How to use Dexie from Chrome devtools. This snippet allow the user to query directly into IndexedDB database, very useful to developed or debug queries.
function dynamicallyLoadScript(url) {
var script = document.createElement("script"); // create a script DOM node
script.src = url; // set its src to the provided URL
document.head.appendChild(script); // add it to the end of the head section of the page (could change 'head' to 'body' to add it to the end of the body section instead)
}
dynamicallyLoadScript('https://npmcdn.com/dexie/dist/dexie.js')
let database = new Dexie('database')
@marc-queiroz
marc-queiroz / freeotp_backup.md
Created January 22, 2021 12:36 — forked from kontez/freeotp_backup.md
A guide to back up and recover 2FA tokens from FreeOTP (Android)

Backing up and recovering 2FA tokens from FreeOTP

Backing up FreeOTP

Using adb, create a backup of the app using the following command:

adb backup -f freeotp-backup.ab -apk org.fedorahosted.freeotp
@marc-queiroz
marc-queiroz / README.md
Last active August 16, 2025 01:04
IPv6 pfSense Copel Telecom

Configuração para pfSense 2.4.5 WAN IPv6 Copel Telecom

Um pouco de história. Para quem não sabe os endereços IPv4 foram esgotados, ou seja, todos 2^32 bits de endereços já tem dono. A maioria dos usuários domésticos e pequenos escritórios ganham no máximo um IPv4 por assinatura. No caso da Copel Telecom é um pouco diferente, pois como usuário você já recebe um IPv4 em NAT. O que isso significa? Que você não controla o tráfego de entrada e saída e alguns serviços podem ser prejudicados. O mais famoso dos serviços é a PSN, rede de jogos do console PlayStation da Sony.

Se você está decepcionado, não fique. O IPv4 foi substituído pelo IPv6, veja Wiki IPv6, que possui 2^128 bits de endereço. A Copel Telecom aposta no IPv6 como novo padrão, não apenas porque chegou tarde na divisão dos IPv4s, mas porque os IPv4s vão deixar de ser usados cedo ou tarde.

Modem Hauwei da Copel Telecom em modo bridge

Se você chegou até aqui, você já sabe que o modo bridge transfere parte a

@marc-queiroz
marc-queiroz / signandrecoveraddress.js
Created August 5, 2020 16:47
Truffle console commands - Learning how to sign a message using a private key and restore the address from hashed message
var ethUtil = require('ethereumjs-util')
var data = 'Hello World!'
var message = new Buffer(data)
var msgHash = ethUtil.hashPersonalMessage(message)
// privateKey = 0xc87509a1c067bbde78beb793e6fa76530b6382a4c0241e5e4a9ec0a0f44dc0d3
// publicKey = 0x627306090abaB3A6e1400e9345bC60c78a8BEf57
var privateKey = new Buffer('c87509a1c067bbde78beb793e6fa76530b6382a4c0241e5e4a9ec0a0f44dc0d3', "hex")
var sig = ethUtil.ecsign(msgHash, privateKey)
@marc-queiroz
marc-queiroz / verify-eth-sig.js
Last active August 5, 2020 14:36 — forked from alexanderattar/verify-eth-sig.js
Example of how to sign a message with web3 and recover the address that signed it
var ethUtil = require('ethereumjs-util');
var data = 'Login';
var message = new Buffer(data);
var msgHash = ethUtil.hashPersonalMessage(message);
var privateKey = new Buffer('62debf78d596673bce224a85a90da5aecf6e781d9aadcaedd4f65586cfe670d2', "hex")
var sig = ethUtil.ecsign(msgHash, privateKey);
var signature = ethUtil.toBuffer(sig)
@marc-queiroz
marc-queiroz / git+overleaf+github.md
Created July 7, 2020 19:49 — forked from jnaecker/git+overleaf+github.md
Using Overleaf as your TeX editor but getting your files to Github

git + overleaf + github

Setup

Connect Overleaf and your local repo

  1. Make a new project on Overleaf.
  2. In the share menu, copy the link from "Clone with git"
  3. On your computer:
    • use cd to navigate to where you want to put your project
@marc-queiroz
marc-queiroz / i3_screenshot_config
Created March 10, 2020 17:21 — forked from schtibe/i3_screenshot_config
Screenshot keybindings with i3 and scrot that are copied to the clipboard
bindsym Print exec "scrot -e 'mv $f ~/tmp && xclip -selection clipboard -t image/png -i ~/tmp/$n'; sleep 1; exec notify-send 'screenshot has been saved to ~/tmp'"
bindsym $mod+Print --release exec "scrot -ue 'mv $f ~/tmp && xclip -selection clipboard -t image/png -i ~/tmp/$n'; sleep 1; exec notify-send 'screenshot has been saved to ~/tmp'"
bindsym $mod+Shift+Print --release exec "notify-send 'selection will be saved to ~/tmp'; scrot -se 'mv $f ~/tmp && xclip -selection clipboard -t image/png -i ~/tmp/$n'"
@marc-queiroz
marc-queiroz / main.py
Created March 1, 2020 19:55
Python generator
funcs = [lambda x: x*x, lambda x: x+x]
arr = [1,2,3,4]
def generator():
for func in funcs:
yield func
for index, func in enumerate([[y for y in generator()] for x in generator()]):
arr = map(func[index], arr)