Skip to content

Instantly share code, notes, and snippets.

View neverkas's full-sized avatar

Emmanuel Lazarte neverkas

View GitHub Profile
@neverkas
neverkas / emacs-fixed-issues.org
Last active October 6, 2023 15:11
Emacs Fixed Issues
@neverkas
neverkas / linux-webcam.mk
Last active August 25, 2023 05:07
Linux Webcam
# cheese
cheese-install:
sudo aptitude install cheese
cheese-run:
cheese
# v4l2loopback
#
# - This module allows you to create "virtual video devices".
@neverkas
neverkas / helper.mk
Created July 8, 2023 21:30
Makefile Menu Helper
# Nota: agregar en el Makefile principal: include helper.mk
.DEFAULT_GOAL=help
##@ Utilidades
h help: ## Mostrar menú de ayuda
@awk 'BEGIN {FS = ":.*##"; printf "\nOpciones para usar:\n make \033[36m\033[0m\n"} /^[$$()% 0-9a-zA-Z_-]+:.*?##/ { printf " \033[36m%-15s\033[0m %s\n", $$1, $$2 } /^##@/ { printf "\n\033[1m%s\033[0m\n", substr($$0, 5) } ' $(MAKEFILE_LIST)
.PHONY: h help
@neverkas
neverkas / gist:1978328cdddd8229b5637fd19a6d0caf
Created July 2, 2023 21:28 — forked from jwebcat/gist:5122366
Properly download from github using wget and curl
wget --no-check-certificate --content-disposition https://github.com/joyent/node/tarball/v0.7.1
# --no-check-cerftificate was necessary for me to have wget not puke about https
curl -LJO https://github.com/joyent/node/tarball/v0.7.1
@neverkas
neverkas / Makefile
Last active June 20, 2023 18:48
ssh config + github (ssh client-side)
SSH_CLIENT_DIR=$${HOME}/.ssh
SSH_CLIENT_DIR_PERMISSIONS=700
SSH_CLIENT_CONFIG=$${HOME}/.ssh/config
SSH_CLIENT_CONFIG_PERMISSIONS=600
PRINT_OCTAL_PERMISSIONS=stat --format='%a'
# se recomienda que sólo el usuario del sistema acceda al directorio ~/.ssh
# caso contrario el comando `ssh-add` NO permitirá agregar Claves Privadas de SSH, diciendo "WARNING: UNPROTECTED PRIVATE KEY FILE!"

Problem

I have two Github accounts: oanhnn (personal) and superman (for work). I want to use both accounts on same computer (without typing password everytime, when doing git push or pull).

Solution

Use ssh keys and define host aliases in ssh config file (each alias for an account).

How to?

  1. Generate ssh key pairs for accounts and add them to GitHub accounts.
@neverkas
neverkas / ssh-agent-autostart.sh
Created June 14, 2023 19:54
Shell Script - autostart SHH Agent (openSSH)
#!/bin/bash
# Objetivos de éste Bash Script
# ==============================
#
# - ejecutar una única instancia del Agente SSH
# (cada vez que se ejecute el ssh-agent se crea una nueva instancia del agente y crea un nuevo archivo tipo socket)
# - al crear una nueva Bash Shell (en un emulador de terminal) el Agente SSH utilice el mismo archivo tipo socket (referenciado por SSH_AUTH_SOCK)
# - la variable de entorno SSH_AUTH_SOCK de cada Bash Shell referencie al mismo archivo tipo socket
@neverkas
neverkas / pgrep-exit-status-example.rst
Last active June 12, 2023 16:39
pgrep + exit status

Conceptos Básicos

Estado de Salida (Exit status)

  • valor devuelto por un programa al terminar su ejecución
  • persiste en la variable especial de bash $?
  • el valor es 0 si el programa tuvo éxito, si es distinto de 0 entonces NO tuvo éxito

STDOUT y STDERR

@neverkas
neverkas / Makefile
Last active June 5, 2023 19:20
configuration neomutt + gmail + oauth2
include install-packages.mk
include mutt.mk
@neverkas
neverkas / Makefile
Created June 4, 2023 22:16
basic gpg encript/decrypt
SECRETO_FILE=secreto.txt
SECRETO_ENCRYPTED=$(SECRETO_FILE).gpg
# debe tener la funcionalidad de [E]ncriptar (encrypt capability)
ID_GPG_KEY=0x373250B7E54E64CC
encriptar:
gpg --recipient=$(ID_GPG_KEY) --encrypt $(SECRETO_FILE)
desencriptar: