Skip to content

Instantly share code, notes, and snippets.

Avatar
:octocat:
Coding

Miguel Mota miguelmota

:octocat:
Coding
View GitHub Profile
@miguelmota
miguelmota / prompt_password.js
Created Apr 9, 2021
Node.js CLI prompt password with hidden input
View prompt_password.js
const prompt = require('prompt)
async function promptPassword () {
prompt.start()
prompt.message = ''
prompt.delimiter = ':'
const { password } = await prompt.get({
properties: {
password: {
message: 'password',
@miguelmota
miguelmota / file_audit.sh
Last active Apr 7, 2021
Linux file audit to detect file changes using auditd, auditctl, ausearch. This can be used to get PID unlike inotify
View file_audit.sh
touch hello.txt
sudo auditd
sudo auditctl -w $PWD/hello.txt -p warx -k hello-file
echo 'hello world' > hello.txt
sudo ausearch -k hello-file
@miguelmota
miguelmota / file_watch.sh
Created Apr 7, 2021
Linux monitor file open/close events using inotify-tools
View file_watch.sh
inotifywatch -v file.txt
@miguelmota
miguelmota / bell.sh
Created Apr 6, 2021
macOS bell sound notification ping alert
View bell.sh
afplay /System/Library/Sounds/Ping.aiff
@miguelmota
miguelmota / fingerprint.sh
Created Mar 26, 2021
SSH generate sha256 fingerprint of public key using ssh-keygen
View fingerprint.sh
ssh-keygen -lf ~/.ssh/id_rsa.pub -E sha256
# output:
# 3072 SHA256:dxQGxpXYbvfa6mk2I3XC17aT3jh6gbF7YPsOwusHGpU user@linux (RSA)
@miguelmota
miguelmota / ImportJSON.gs
Created Mar 25, 2021
Google sheets import JSON script
View ImportJSON.gs
/**
* Imports JSON data to your spreadsheet
* @param url URL of your JSON data as string
* @param xpath simplified xpath as string
* @customfunction
*/
function ImportJSON(url, xpath) {
try {
// /rates/EUR
var res = UrlFetchApp.fetch(url);
@miguelmota
miguelmota / pass.txt
Created Mar 23, 2021
Arch linux PrivateInternetAccess (PIA) OpenVPN VPN setup
View pass.txt
<username>
<password>
@miguelmota
miguelmota / transmission.sh
Created Mar 23, 2021
Arch linux transmission bittorrent daemon terminal cli webui
View transmission.sh
yay -S transmission-cli
# start daemon with config overrides
transmission-daemon --auth --username arch --password linux --port 9091 --allowed "127.0.0.1,192.168.*.*"
# webui
open http://192.168.254.12:9091/transmission/web/
# settings config
vim ~/.config/transmission-daemon/settings.json
@miguelmota
miguelmota / notes.txt
Created Mar 19, 2021
DeFi reading notes
View notes.txt
Saddle finance
- https://saddle.exchange/
- AMM for pegged tokens like bitcoin and stablecoins
- created by tBTC venture studio
- based on StableSwap curve whitepaper https://curve.fi/files/stableswap-paper.pdf
@miguelmota
miguelmota / setup.sh
Created Mar 17, 2021
Keybase github setup gpg keys for verified commits
View setup.sh
keybase pgp export | gpg --import
keybase pgp export --secret | gpg --allow-secret-key --import
gpg --list-secret-keys
gpg --edit-key <key-id>
> trust
> 5 (trust ultimately)
git config --global user.signingKey <key-id>
git config --global commit.gpgsign true
gpg --armor --export <key-id>