Skip to content

Instantly share code, notes, and snippets.

#!/bin/bash
echo "this is from gists"
sudo apt update
sudo apt install sl -y
sl
@cechus
cechus / main.py
Created December 20, 2020 23:47
Gift Problem
def gift(n, m):
if m < n :
return "Intenta generar un nuevo número para que alcancen los regalos."
return "Cada niño recibirá %s regalos. Asi que la respuesta es %s" % (m//n, m//n*n)
print(gift(3, 10))
print(gift(8, 10))
print(gift(4, 3))
@cechus
cechus / cloudSettings
Last active May 16, 2020 23:44
Visual Studio Code Settings Sync Gist
{"lastUpload":"2020-05-16T23:43:26.460Z","extensionVersion":"v3.4.3"}
@cechus
cechus / postgres-cheatsheet.md
Created December 21, 2018 13:48 — forked from Kartones/postgres-cheatsheet.md
PostgreSQL command line cheatsheet

PSQL

Magic words:

psql -U postgres

Some interesting flags (to see all, use -h or --help depending on your psql version):

  • -E: will describe the underlaying queries of the \ commands (cool for learning!)
  • -l: psql will list all databases and then exit (useful if the user you connect with doesn't has a default database, like at AWS RDS)
@cechus
cechus / LICENCE SUBLIME TEXT
Created September 16, 2018 23:55
Sublime Text 3 Serial key build is 3176
## Sublime Text 3 Serial key build is 3176
> * Added these lines into /etc/hosts
127.0.0.1 www.sublimetext.com
127.0.0.1 license.sublimehq.com
> * Used the license key
----- BEGIN LICENSE -----
@cechus
cechus / with-data-attributes.js
Created September 16, 2018 22:06 — forked from JeffreyWay/with-data-attributes.js
Vue Tooltips: Three Ways
import PopperTooltip from 'tooltip.js';
new Vue({
el: '#app',
mounted() {
document.querySelectorAll('[data-tooltip]').forEach(elem => {
new PopperTooltip(elem, {
placement: elem.dataset.tooltipPlacement || 'top',
title: elem.dataset.tooltip
@cechus
cechus / .sql
Created July 13, 2018 15:10
add delete on cascade
ALTER TABLE public.ret_fun_address_beneficiary
DROP CONSTRAINT ret_fun_address_beneficiary_ret_fun_beneficiary_id_foreign;
ALTER TABLE public.ret_fun_address_beneficiary
ADD CONSTRAINT ret_fun_address_beneficiary_ret_fun_beneficiary_id_foreign
FOREIGN KEY (ret_fun_beneficiary_id) REFERENCES ret_fun_beneficiaries (id) ON DELETE CASCADE;
ALTER TABLE public.ret_fun_address_beneficiary
DROP CONSTRAINT ret_fun_address_beneficiary_address_id_foreign;
ALTER TABLE public.ret_fun_address_beneficiary
ADD CONSTRAINT ret_fun_address_beneficiary_address_id_foreign
@cechus
cechus / install.sh
Created May 27, 2018 02:37 — forked from wdullaer/install.sh
Install Latest Docker and Docker-compose on Ubuntu
# Ask for the user password
# Script only works if sudo caches the password for a few minutes
sudo true
# Install kernel extra's to enable docker aufs support
# sudo apt-get -y install linux-image-extra-$(uname -r)
# Add Docker PPA and install latest version
# sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys 36A1D7869245C8950F966E92D8576A8BA88D21E9
# sudo sh -c "echo deb https://get.docker.io/ubuntu docker main > /etc/apt/sources.list.d/docker.list"
@cechus
cechus / docker-destroy-all.sh
Created May 25, 2018 00:28 — forked from JeffBelback/docker-destroy-all.sh
Destroy all Docker Containers and Images
#!/bin/bash
# Stop all containers
docker stop $(docker ps -a -q)
# Delete all containers
docker rm $(docker ps -a -q)
# Delete all images
docker rmi $(docker images -q)
# remove specific file from git cache
git rm --cached filename
# remove all files from git cache
git rm -r --cached .
git add .
git commit -m ".gitignore is now working"