Skip to content

Instantly share code, notes, and snippets.

View royki's full-sized avatar
😃
I may be slow to respond.

ROY royki

😃
I may be slow to respond.
View GitHub Profile
@alonsoir
alonsoir / deploy.yaml
Created January 5, 2024 12:41
ansible script to gather VAULT_TOKEN from a VAULT server and run a process which need it. The idea is to maintain secrets in secure, deleting VAULT_TOKEN from file system and historic.
---
- name: Ejecutar Proceso con VAULT_TOKEN
hosts: localhost # Puedes ajustar los hosts según tu entorno
gather_facts: false # Desactivar recopilación de hechos
vars:
vault_address: "http://direccion-de-tu-vault:8200" # Ajusta la dirección de tu Vault Server
tasks:
- name: Establecer VAULT_TOKEN como variable de entorno
@adamw
adamw / gen.scala
Created September 6, 2022 07:15
How to generate an exhaustive match for a sealed trait in a Scala 3 macro?
// TestMacro.scala
import scala.quoted.*
object TestMacro {
inline def name[E](e: E): String = ${ nameImpl[E]('e) }
def nameImpl[E: Type](e: Expr[E])(using Quotes): Expr[String] = {
import quotes.reflect.*
@royki
royki / fdisk.md
Last active November 29, 2020 19:31
Increase partition size in Ubuntu

➜ ~ sudo fdisk /dev/sda

Welcome to fdisk (util-linux 2.34).
Changes will remain in memory only, until you decide to write them.
Be careful before using the write command.


Command (m for help): p
Disk /dev/sda: 24.42 GiB, 26214400000 bytes, 51200000 sectors
@royki
royki / .tmux.conf
Created April 8, 2020 21:26
Tmux Conf file
# Send prefix
set-option -g prefix C-a
unbind-key C-a
bind-key C-a send-prefix
# Use Alt-arrow keys to switch panes
bind -n M-Left select-pane -L
bind -n M-Right select-pane -R
bind -n M-Up select-pane -U
bind -n M-Down select-pane -D
@royki
royki / terminal.md
Last active November 29, 2020 19:32
Terminal Visible

Button Layout

===================

  • Gnome/Unity/gdm
    • Left -> gsettings set org.gnome.desktop.wm.preferences button-layout 'close,maximize,minimize:'
    • Right -> gsettings set org.gnome.desktop.wm.preferences button-layout ':close,maximize,minimize'
    • gsettings set org.gnome.desktop.wm.preferences button-layout ':minimize,maximize,close'

Minimize OnClick Settings

==============================

  • gsettings set org.gnome.shell.extensions.dash-to-dock click-action 'minimize'
@royki
royki / scp.md
Last active November 29, 2020 19:32
copy commad over ssh

To copy using scp and no password

  • create a folder of own user and become the owner of that folder by chown: folder_name

copy over ssh using scp

Copy a Local File to a Remote System with the scp Command

  • scp file.txt [email protected]:/remote/directory
  • If SSH on the remote host is listening on a port other than the default 22 then you can specify the port using the -P argument:
@royki
royki / usermod.md
Last active November 29, 2020 20:40
Linux Add user in sudo/wheel, Enable root user login

Add user to group and make sudoer/nopassword-access

Ubuntu

  • adduser username
  • usermod -aG groupname username or gpasswd -a user_name group_name
    • usermod -aG sudo username
  • visudo
    • username ALL=(ALL) NOPASSWD:ALL
  • Remove a user from a group
object Solution {
def solution(N: Int): Int = {
if (N < 1) sys.error(s"Invalid input: $N")
@scala.annotation.tailrec
def foo(i: Int, total: Int): (Int, Int) = {
if ((i * i) >= N) (total, i)
else if (N % i == 0) foo(i + 1, total + 2)
else foo(i + 1, total)
}

Overview

Here you will find instructions for importing the datasets for M001: MongoDB Basics into a locally running MongoDB deployment.

Datasets

All datasets are provided in Amazon S3 in a single zip file (243 MB zipped; 1.5 GB unzipped). The files were created with the mongodump command. They may be imported into your MongoDB deployment using mongorestore. Note that these datasets include the indexes necessary to support example queries and labs used in M001. The datasets included are as follows.