Skip to content

Instantly share code, notes, and snippets.

View RamsesMartinez's full-sized avatar
🏠
Working from home

Ramsés Martínez Ortiz RamsesMartinez

🏠
Working from home
View GitHub Profile
@RamsesMartinez
RamsesMartinez / text-alignment.py
Created March 25, 2022 02:49
Python Text Aligment Solution - HackerRank
def print_logo(thickness):
c = 'H'
# Triangulo principal
for i in range(thickness):
print((c * i).rjust(thickness - 1) + c + (c * i).ljust(thickness - 1))
# Columnas superiores
for i in range (thickness + 1):
print((c * thickness).center(thickness * 2) + (" " * thickness * 2) + (c * thickness).center(thickness * 2))
@RamsesMartinez
RamsesMartinez / nginx.conf
Created October 23, 2020 03:24 — forked from mccabiles/nginx.conf
Using gzip with Nginx and Vue CLI project
...
gzip on;
gzip_static on;
gzip_types text/plain text/css application/json application/x-javascript text/xml application/xml application/xml+rss text/javascript;
gzip_proxied any;
gzip_vary on;
gzip_comp_level 6;
gzip_buffers 16 8k;
gzip_http_version 1.1;
@RamsesMartinez
RamsesMartinez / docker_kill.md
Last active June 15, 2020 09:12 — forked from evanscottgray/docker_kill.sh
kill all docker containers at once...

stop all containers:

docker kill $(docker ps -q)

remove all containers

docker rm $(docker ps -a -q)
@RamsesMartinez
RamsesMartinez / cmder-in-webstorm.md
Created November 2, 2018 19:47 — forked from sadikaya/cmder-in-webstorm.md
Cmder inside Webstorm terminal
  1. Set an environment variable called CMDER_ROOT to your root Cmder folder (in my case C:\Program Files (x86)\Cmder). It seems to be important that this does not have quotes around it because they mess with concatenation in the init script.
  2. In your IntelliJ terminal settings, use "cmd" /k ""%CMDER_ROOT%\vendor\init.bat"" as the Shell path. The double-double-quotes are intentional, as they counteract the missing double quotes in the environment variable.
Drop:
docker-compose exec db psql -U postgres -c "DROP DATABASE your-database"
Backup:
docker exec -t -u postgres your-db-container pg_dumpall -c > dump_`date +%d-%m-%Y"_"%H%M%S`.sql
Restore:
cat your_dump.sql | docker exec -i your-db-container psql -U postgres
@RamsesMartinez
RamsesMartinez / number-format.js
Created May 13, 2018 03:43 — forked from jrobinsonc/number-format.js
Funcion para darle formato a un número. #javascript #numbers
function number_format(amount, decimals) {
amount += ''; // por si pasan un numero en vez de un string
amount = parseFloat(amount.replace(/[^0-9\.]/g, '')); // elimino cualquier cosa que no sea numero o punto
decimals = decimals || 0; // por si la variable no fue fue pasada
// si no es un numero o es igual a cero retorno el mismo cero
if (isNaN(amount) || amount === 0)
return parseFloat(0).toFixed(decimals);
# Parar todos los contenedores
docker stop $(docker ps -a -q)
# Eliminar todos los contenedores
docker rm $(docker ps -a -q)
# Eliminar todas las imágenes
docker rmi $(docker images -q)

Put into keymap.cson:

'.editor:not(.mini)':
  'alt-ctrl-i': 'editor:auto-indent'

And restart your Atom.

@RamsesMartinez
RamsesMartinez / git.config
Created December 11, 2017 15:30 — forked from jespada/git.config
git nice log
git config --global alias.lg "log --color --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr)%C(bold blue)<%an>%Creset' --abbrev-commit"
@RamsesMartinez
RamsesMartinez / upgrade-postgres-9.4-to-9.6.md
Created September 7, 2017 02:34 — forked from dmitrykustov/upgrade-postgres-9.4-to-9.6.md
Upgrading PostgreSQL from 9.4 to 9.6 on Debian Jessie

To use the most modern version of Postgres software we need to add postgresql repository. Edit /etc/apt/sources.list or create /etc/apt/sources.list.d/pgdg.list and add there a line: deb http://apt.postgresql.org/pub/repos/apt/ jessie-pgdg main Then import the repository signing key, and update the package lists:

wget --quiet -O - https://www.postgresql.org/media/keys/ACCC4CF8.asc | sudo apt-key add -
sudo apt-get update

Install a new version of PostgreSQL server.

Once the Debian upgrade finished, I used dpkg-query -l postgresql* to check which versions of postgres I have installed.