Skip to content

Instantly share code, notes, and snippets.

View r3gor's full-sized avatar

Roger Ramos Paredes r3gor

View GitHub Profile
@r3gor
r3gor / init.vim
Last active April 8, 2024 05:25
vim script config - vimplug
:set number
:set relativenumber
:set autoindent
:set tabstop=4
:set shiftwidth=4
:set smarttab
:set softtabstop=4
:set mouse=a
:set whichwrap+=<,>,[,] " right move in the first char of non first line move to end of previous line
:set foldmethod=syntax
@r3gor
r3gor / .gitconfig
Created February 22, 2022 22:12
git aliases
# https://stackoverflow.com/questions/1057564/pretty-git-branch-graphs
[alias]
lg1 = log --graph --abbrev-commit --decorate --format=format:'%C(bold blue)%h%C(reset) - %C(bold green)(%ar)%C(reset) %C(white)%s%C(reset) %C(dim white)- %an%C(reset)%C(bold yellow)%d%C(reset)' --all
lg2 = log --graph --abbrev-commit --decorate --format=format:'%C(bold blue)%h%C(reset) - %C(bold cyan)%aD%C(reset) %C(bold green)(%ar)%C(reset)%C(bold yellow)%d%C(reset)%n'' %C(white)%s%C(reset) %C(dim white)- %an%C(reset)' --all
lg = !"git lg1"
dog = log --all --decorate --oneline --graph
@r3gor
r3gor / dark.js
Created October 23, 2021 07:38
dark mode pdf
/*
Dark mode
Execute the following code in your browser console.
https://superuser.com/questions/1527410/how-can-i-preview-pdfs-with-google-chrome-in-dark-mode/1527417
*/
var cover = document.createElement("div");
let css = `
position: fixed;
pointer-events: none;
@r3gor
r3gor / mod_exp.py
Created February 8, 2020 08:51
Modular Exponentiation used in the RSA public key cryptographic system
"""
Modular Exponentiation (Rapid Exponentiation)
---------------------------------------------
Efficient algorithm used in the RSA public key cryptographic system
More info:
https://en.wikipedia.org/wiki/Modular_exponentiation
"""
from time import time
@r3gor
r3gor / move.cpp
Created February 8, 2020 08:20
Show simple move effect in the command prompt.
/*
Show simple move effect in the command prompt.
X-axis movement (right to left), with recursion
loop (in moveAnimation function)
[ More ASCII art to show in this program ]
[------> https://www.asciiart.eu <-------]
_ ,_, _
/ `'=) (='` \
@r3gor
r3gor / walk.cpp
Last active February 8, 2020 00:27
simple animation of person walking in c++
#include <iostream>
#include <windows.h>
using namespace std;
int main() {
char human[4][4]={
" O " ,
"/|\\",
" | ",
@r3gor
r3gor / monty_hall.cpp
Last active June 9, 2020 22:25
Simulation to the Monty Hall Paradox
/*
Simulation to the Monty Hall Paradox
https://es.wikipedia.org/wiki/Problema_de_Monty_Hall
*/
#include <iostream>
#include <cstdlib>
#include <ctime>
using namespace std;
@r3gor
r3gor / fibonacci.py
Last active February 8, 2020 00:28
Testing performance fibonacci function with Dynamic Programming
""" Performance fibonacci function with Dynamic Programming """
import time
def fib1(n):
""" simple recursive algorithm """
if (n == 1 or n == 2):
return 1
return fib1(n-1) + fib1(n-2)