Skip to content

Instantly share code, notes, and snippets.

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

Paulo Fabrício paulozullu

🏠
Working from home
View GitHub Profile
@paulozullu
paulozullu / rjava_installation.md
Last active October 18, 2017 14:46
Problem with permission to rJava.so and/or instalation of rJava, openNLP, etc. in Ubuntu 16.04

Stackoverflow link

For Ubuntu, oracle-java (7/8) installed. It'll be at this location /usr/lib/jvm and sudo access is required.

Create the file /etc/ld.so.conf.d/java.conf with the following entries:

/usr/lib/jvm/java-8-oracle/jre/lib/amd64
/usr/lib/jvm/java-8-oracle/jre/lib/amd64/server
@paulozullu
paulozullu / workon_in_bash_script.md
Created October 18, 2017 15:12
Add the ability of bash script to recognize workon command.

Just source the virtualenvwrapper.sh script in your script to import the virtualenvwrapper's functions. You should then be able to use the workon function in your script.

And maybe better, you could create a shell script (you could name it venv-run.sh for example) to run any Python script into a given virtualenv, and place it in /usr/bin, /usr/local/bin, or any directory which is in your PATH.

Such a script could look like this:

# if virtualenvwrapper.sh is in your PATH (i.e. installed with pip)
source `which virtualenvwrapper.sh`
#source /path/to/virtualenvwrapper.sh # if it's not in your PATH
@paulozullu
paulozullu / Neo4j.md
Last active January 13, 2020 18:01
Neo4j

1 - Get node by ID

MATCH (s)
WHERE ID(s) = 65110
RETURN s

2 - Add attribute to the existing relationships (probability=1 or 100%)

MATCH()-[r:relationship]->()
@paulozullu
paulozullu / celery.MD
Last active March 5, 2018 12:31
Comandos para debugar o celery

Iniciar os workers

celery -A ecminer worker -l info -E

Executar tasks agendadas

celery -A ecminer beat -l info
@paulozullu
paulozullu / SQL.MD
Last active May 3, 2022 14:27
Queries in SQL (PostgreSQL)

MD5 hash

SELECT * FROM TABLE WHERE md5(field::text) = 'text to be hashed'

LIKE query in psycopg2

arg = "TEXT TO BE FOUND"
@paulozullu
paulozullu / linux_commands.MD
Last active June 6, 2018 19:06
Linux commands

Find a file

sudo find / -iname 'filename.ext' -print

Fix error on running pip, easy_install and openning the terminal

sudo rm -rf /usr/lib/python2.7/lib-dynload/_hashlib.x86_64-linux-gnu.so 
@paulozullu
paulozullu / virtualenv_python3.rst
Last active February 16, 2018 17:32
Install virtualenvwrapper

Create a virtualenv with Python3:

$ mkvirtualenv -p python3 envname
@paulozullu
paulozullu / python_tips.MD
Last active April 16, 2021 12:19
Python and Django tips

1 - Check if an element exists in a list of dictionnaires

my_list = [
    {'main_color': 'red', 'second_color':'blue'},
    {'main_color': 'yellow', 'second_color':'green'},
    {'main_color': 'yellow', 'second_color':'blue'},
]

if not any(my_dict['main_color'] == 'red' for my_dict in my_list):
    # does not exist
@paulozullu
paulozullu / libreoffice_calc.MD
Last active June 8, 2025 03:59
Libre Office Calc Tips

Convert UNIX timestamp to date in LibreOffice Calc

As it seems, OpenOffice's "day 0" is December 12th, 1899; that implies that January 1st, 1970 is day 25569 for OpenOffice. Now, if you divide a UNIX timestamp by 86400 (the number of seconds in a normal day), that will give you the number of days between the epoch and that timestamp (and some decimal, that you can use to calculate the time of day). And if you sum that number with 25569, you have an OpenOffice day for that timestamp.

Alright, let's put all the pieces together: let's say cell A2 contains a UNIX timestamp 1341104400, then this formula

=A2/86400+25569

will return a number. And if you format that cell as a date, DD/MM/YYYY HH:MM:SS, then you'll read a pretty "01/07/2012 01:00:00" there.

@paulozullu
paulozullu / linux_tips.MD
Last active May 7, 2022 11:16
Linux tips

Fixes and tips for Linux

1 - Headset mic not recognized

$ sudo nano /etc/modprobe.d/alsa-base.conf

Add bottom:

options snd-hda-intel model=laptop-dmic

Save and reboot