Skip to content

Instantly share code, notes, and snippets.

View sg-gs's full-sized avatar
📈
Simpler = better

Sergio Gutiérrez sg-gs

📈
Simpler = better
View GitHub Profile
@sg-gs
sg-gs / mobile_backup_template.js
Last active April 9, 2026 14:19
An upload-only POC for a mobile app. (a backup system)
async function startBackup() {
// 3.2 When enabling backups, the user is prompted for access to the photo library.
const permission = await requestGalleryPermission();
if (permission === "denied") {
notifyUser("Sin permisos, backup pausado");
return;
}
// register if first time.
@sg-gs
sg-gs / install-r-kernel-in-jupyer.md
Last active October 1, 2024 12:48 — forked from aaizemberg/guia.md
instalando el kernel de R para jupyter notebook
@sg-gs
sg-gs / fuse.js
Created October 20, 2023 10:14
fuse
const fuse = require('fuse-bindings');
const path = require('path');
const fs = require('fs');
const mountPath = '/mnt/mi_sistema_de_archivos';
const fileSystem = {
// Implementa las funciones de sistema de archivos FUSE
readdir: (path, callback) => {
if (path === '/') {
@sg-gs
sg-gs / README.md
Created September 16, 2023 10:01 — forked from arikfr/README.md
Setting up HTTPS with LetsEncrypt for Redash Docker Deployment
  1. Make sure the domain you picked points at the IP of your Redash server.
  2. Switch to the root user (sudo su).
  3. Create a folder named nginx in /opt/redash.
  4. Create in the nginx folder two additional folders: certs and certs-data.
  5. Create the file /opt/redash/nginx/nginx.conf and place the following in it: (replace example.redashapp.com with your domain name)
    upstream redash {
        server redash:5000;
    }
    
kubectl get secret <secrets_name> -o go-template='{{range $k,$v := .data}}{{printf "%s=" $k}}{{if not $v}}{{$v}}{{else}}{{$v | base64decode}}{{end}}{{"\n"}}{{end}}'
EOF
@sg-gs
sg-gs / cp_android_emulator_to_mac.txt
Last active February 1, 2022 17:33
Copy a file from Android device emulator to your local filesystem (MacOS)
# ADB is required
adb shell
> run-as com.your.package # this should be the folder where the desired file to copy is located, in my case it was generated by an Android React-Native package
> cd files/
> cp desiredFile /sdcard
> exit
> exit
adb pull /sdcard/desiredFile /destination/path/on/my/local/file/system
@sg-gs
sg-gs / mongodb_backup_restore
Created October 24, 2021 09:49 — forked from JAlbertoGonzalez/mongodb_backup_restore
Backup & restore MongoDB database
# BACKUP
mongodump -u "USER_NAME" -p "USER_PASSWORD" --archive=test.gz --gzip --db DATABASENAME
# RESTORE
mongorestore --gzip --archive=test.gz --nsInclude 'DATABASENAME.*'
# If failed, edit /etc/mongodb.cong and set/uncomment noauth = true
# After edition, sudo service mongodb restart
@sg-gs
sg-gs / mysql_install
Created October 24, 2021 09:49 — forked from JAlbertoGonzalez/mysql_install
Installation of local MySQL on Ubuntu
sudo apt update
sudo apt install mysql-server
sudo mysql
# Drop root@localhost user to recreate it
DROP USER 'root'@'localhost';
CREATE USER 'root'@'localhost';
GRANT ALL ON *.* TO 'root'@'localhost' WITH GRANT OPTION;
CREATE USER 'root'@'%' IDENTIFIED BY 'password';

Paso 1. Enchufa/conecta/añade el nuevo volumen a la máquina de linux.

Paso 2. Ejecuta el comando lsblk e identifica cuál de todos es tu nuevo volumen.

Usa como pistas las columnas TYPE (debe ser disk), SIZE (el tamaño del volumen, normalmente lo sabemos de antemano, si hemos enchufado un volumen de 300GB, será el volumen que tenga 300GB), y MOUNTPOINT (el nuevo volumen no tiene ningún punto de montaje, aún, probablemente sea la única línea disk a la que le falte este valor).

Si tu disco no aparece porque has conectado el volumen con la máquina encendida, reinicia la máquina y vuelve a ejecutar este comando.

Ejemplo de lsblk en una máquina virtual que he creado con un volumen de 100G:

1. Login into mysql console
> mysql -u root -p
(-p parameter will ask you the password with a hidden prompt)
2. Watch available users to change passwords:
> select user, host, password from mysql.user;