Skip to content

Instantly share code, notes, and snippets.

View rtorresve's full-sized avatar

Rafael Torres rtorresve

View GitHub Profile
@rtorresve
rtorresve / concat.js
Last active March 25, 2020 20:16
JS concat not empy object values
const myObj = {
a: 1,
b:'foo',
c: '',
d: null,
e: undefined
};
const removeEmpty = (obj) => {
@rtorresve
rtorresve / search.py
Created October 18, 2019 00:13
Script to search items using cement
#!/usr/bin/python3
import subprocess
from cement import App
def find_occurences(stores, items, fpath=None):
print('find ocurrences')
for _id in items:
if fpath:
@rtorresve
rtorresve / move_repo.md
Created September 26, 2019 19:51
Move a branch to a new remote url with all its branchs and commit history.
$ git clone --mirror [email protected]:arquitectura.ss/solutions-management-app-mayorista-backend.git BE
$ cd BE
$ git remote set-url --push origin [email protected]:walmartretail/cvm-api.git
$ git push --mirror
@rtorresve
rtorresve / cache.py
Created September 20, 2019 22:53
Using python cache
import time
from functools import lru_cache
@lru_cache()
def task(a,b):
print('Init task')
time.sleep(2)
return a + b
task.cache_clear()
@rtorresve
rtorresve / hashid_test.py
Created December 11, 2018 23:00
Hash Id decrypt implementation
# -*- coding: utf-8 -*-
# using hashids-1.2.0 and python 2.7.*
from hashids import Hashids
hashids = Hashids("S4mpl3 H4sh", 16, "abcdefABCDEF1234567890")
download_token = '4061c00d07f7526356bb170233e229499df81fDc516c8de204'
sample = dict()
values = hashids.decode(download_token[32:])
@rtorresve
rtorresve / virtualenvwrapper_osx.md
Last active November 16, 2017 17:22
How install python virtualenvwrapper on OSX

Install virtualenvwrapper on OSX

To install this package you previously need install python3 in your host, I use Homebrew to do it.

$ brew install python3

Later you need download and install the python pip using python3 version.

@rtorresve
rtorresve / mysql-worktrial
Created October 12, 2017 11:04
Create a custom image to mysql server
FROM mysql:8.0.2
RUN echo 'sql-mode=""' >> /etc/mysql/conf.d/docker.cnf
RUN echo 'secure_file_priv=""' >> /etc/mysql/conf.d/docker.cnf
@rtorresve
rtorresve / secondMonitorResolution.sh
Last active October 1, 2017 11:49
Set second monitor resolution
#!/bin/bash
xrandr --newmode "1440x900_59.90" 106.29 1440 1520 1672 1904 900 901 904 932 -HSync +Vsync
xrandr --addmode VGA-1 1440x900_59.90
xrandr --output VGA-1 --mode 1440x900_59.90
@rtorresve
rtorresve / Dockerfile
Created September 7, 2017 18:54
python dockerfile with mysql lybraries
FROM python:3.6-alpine3.6
MAINTAINER Rafael Torres <[email protected]>
RUN apk add --update \
mariadb-client-libs \
mariadb-dev \
gcc \
musl-dev \
bash \