Compresión de ficheros con 7zip en Linux.
7z a -t7z -m0=lzma2 -mx=9 -mfb=64 -md=64m -ms=on comprimido.7z -mhe -pSECRET mi_carpeta_a_comprimir- t7z : archivo 7z
| const axios = require('axios').default; | |
| const cheerio = require('cheerio'); | |
| (async () => { | |
| try { | |
| const response = await axios.get("https://www.gob.pe/feriados"); | |
| const body = await response.data; | |
| const $ = cheerio.load(body); | |
| const elements = $('ul > li > .holidays__list-item-date, .holidays__list-item-name').map((i, e) => e.children[0].data); |
See this issue.
Docker best practise to Control and configure Docker with systemd.
Create daemon.json file in /etc/docker:
{"hosts": ["tcp://0.0.0.0:2375", "unix:///var/run/docker.sock"]}
| -- show running queries (pre 9.2) | |
| SELECT procpid, age(clock_timestamp(), query_start), usename, current_query | |
| FROM pg_stat_activity | |
| WHERE current_query != '<IDLE>' AND current_query NOT ILIKE '%pg_stat_activity%' | |
| ORDER BY query_start desc; | |
| -- show running queries (9.2) | |
| SELECT pid, age(clock_timestamp(), query_start), usename, query | |
| FROM pg_stat_activity | |
| WHERE query != '<IDLE>' AND query NOT ILIKE '%pg_stat_activity%' |
| /** | |
| * Verifica que un DNI de Perú sea valido | |
| * @param {String} data DNI | |
| * @returns {Boolean} | |
| */ | |
| const validate = data => { | |
| const dni = data.replace('-', '').trim().toUpperCase() | |
| if (!dni || dni.length < 9) return false | |
| const multiples = [3, 2, 7, 6, 5, 4, 3, 2] | |
| const dcontrols = { |
| # Redis Cheatsheet | |
| # All the commands you need to know | |
| redis-server /path/redis.conf # start redis with the related configuration file | |
| redis-cli # opens a redis prompt | |
| # Strings. |
| var async = require('async'); | |
| async.waterfall( | |
| [ | |
| function(callback) { | |
| callback(null, 'Yes', 'it'); | |
| }, | |
| function(arg1, arg2, callback) { | |
| var caption = arg1 +' and '+ arg2; | |
| callback(null, caption); |
| db.getCollection('apiai_responses').aggregate([ | |
| { | |
| $match: | |
| { | |
| $and: [ | |
| { 'address.bot.id': '464021083618709' }, | |
| { 'timestamp': { $gte: '2018-01-15T15:00:00', $lte: '2018-01-15T16:00:00' } } | |
| ] | |
| } | |
| } |
| 'use strict'; | |
| const token = '<PUT TOKEN HERE>'; | |
| var Intercom = require('intercom-client'); | |
| var client = new Intercom.Client({ token: token }); | |
| //this return a promise. | |
| client.users.create({ | |
| user_id: 0, |
| /* Modern Font Stacks */ | |
| /* System */ | |
| font-family: system, -apple-system, ".SFNSText-Regular", "San Francisco", "Roboto", "Segoe UI", "Helvetica Neue", "Lucida Grande", sans-serif; | |
| /* Times New Roman-based serif */ | |
| font-family: Cambria, "Hoefler Text", Utopia, "Liberation Serif", "Nimbus Roman No9 L Regular", Times, "Times New Roman", serif; | |
| /* A modern Georgia-based serif */ | |
| font-family: Constantia, "Lucida Bright", Lucidabright, "Lucida Serif", Lucida, "DejaVu Serif," "Bitstream Vera Serif", "Liberation Serif", Georgia, serif; |