Skip to content

Instantly share code, notes, and snippets.

View hectorperez's full-sized avatar

Hector Perez hectorperez

View GitHub Profile
@hectorperez
hectorperez / cla
Created August 18, 2022 17:43
Notesclub Contributor License Agreement
Thank you for your contribution to Notesclub! For us to accept your changes, you must agree with our Contributor License Agreement. There are two agreements below, if you are:
Signing on your behalf as an individual, you agree to the Notesclub Individual Contributor License Agreement below.
Signing on behalf of an entity, you agree to the Notesclub Entity Contributor License Agreement below.
Notesclub Individual Contributor License Agreement
Thank you for your interest in contributing to Notesclub ("We" or "Us").
This contributor agreement ("Agreement") documents the rights granted by contributors to Us. To make this document effective, please sign it and send it to Us by electronic submission, following the instructions at https://cla-assistant.io/notesclub/notesclub. This is a legally binding document, so please read it carefully before agreeing to it. The Agreement may cover more than one software project managed by Us.
@hectorperez
hectorperez / 0 - How to run a task
Last active March 18, 2022 14:41
How to run a mix task on Gigalixir using distillery #Elixir #Phoenix
# Run task in development:
mix whatever
# Run task in staging/production:
gigalixir run bin/my_app whatever --app_name=...
@hectorperez
hectorperez / curl.md
Created May 4, 2018 13:57 — forked from subfuzion/curl.md
curl POST examples

Common Options

-#, --progress-bar Make curl display a simple progress bar instead of the more informational standard meter.

-b, --cookie <name=data> Supply cookie with request. If no =, then specifies the cookie file to use (see -c).

-c, --cookie-jar <file name> File to save response cookies to.

@hectorperez
hectorperez / new_file0
Created September 14, 2017 12:00
get source code of function in python
import inspect
print(inspect.getsource(function_name))
@hectorperez
hectorperez / new_file0
Created May 2, 2017 09:49
declare/create rabbitmq queue
rabbitmqadmin declare queue name=my_queue_name durable=true
rabbitmqctl list_queues
@hectorperez
hectorperez / new_file0
Created April 28, 2017 14:58
mysql subquery
SELECT *
FROM some_table
WHERE relevant_field IN
(
SELECT * FROM
(
SELECT relevant_field
FROM some_table
GROUP BY relevant_field
) AS subquery
select w.name, a.extent from agreelist.agreements a
join agreelist.individuals i on i.id=a.individual_id
join(
SELECT JSON_EXTRACT_SCALAR(item, ‘$.id’) id,
JSON_EXTRACT_SCALAR(item, ‘$.sitelinks.enwiki.title’) name,
JSON_EXTRACT_SCALAR(item, ‘$.claims.P108[0].mainsnak.datavalue.value.numeric-id’) award1,
JSON_EXTRACT_SCALAR(item, ‘$.claims.P108[1].mainsnak.datavalue.value.numeric-id’) award2,
JSON_EXTRACT_SCALAR(item, ‘$.claims.P108[2].mainsnak.datavalue.value.numeric-id’) award3,
JSON_EXTRACT_SCALAR(item, ‘$.claims.P108[3].mainsnak.datavalue.value.numeric-id’) award4,
JSON_EXTRACT_SCALAR(item, ‘$.claims.P108[4].mainsnak.datavalue.value.numeric-id’) award5,
select w.name, a.extent from agreelist.agreements a
join agreelist.individuals i on i.id=a.individual_id
join(
SELECT JSON_EXTRACT_SCALAR(item, ‘$.id’) id,
JSON_EXTRACT_SCALAR(item, ‘$.sitelinks.enwiki.title’) name,
JSON_EXTRACT_SCALAR(item, ‘$.claims.P166[0].mainsnak.datavalue.value.numeric-id’) award1,
JSON_EXTRACT_SCALAR(item, ‘$.claims.P166[1].mainsnak.datavalue.value.numeric-id’) award2,
JSON_EXTRACT_SCALAR(item, ‘$.claims.P166[2].mainsnak.datavalue.value.numeric-id’) award3,
JSON_EXTRACT_SCALAR(item, ‘$.claims.P166[3].mainsnak.datavalue.value.numeric-id’) award4,
JSON_EXTRACT_SCALAR(item, ‘$.claims.P166[4].mainsnak.datavalue.value.numeric-id’) award5,
@hectorperez
hectorperez / Copy all to file - screen
Created September 13, 2016 14:16
Copy all to file - screen
Ctrl + a and then :
hardcopy -h <filename>
@hectorperez
hectorperez / clean - truncate log file
Created February 1, 2016 13:55
clean/truncate log file
truncate logfile --size 0