Skip to content

Instantly share code, notes, and snippets.

View fmontes's full-sized avatar
🎯
Focusing

Freddy Montes fmontes

🎯
Focusing
View GitHub Profile
@fmontes
fmontes / server.js
Created April 1, 2022 21:49
Server to return a screenhot of the page you pass in the URL like: http://localhost:3000/?url=https://demo.dotcms.com
const puppeteer = require('puppeteer');
const http = require('http');
const url = require('url');
const requestListener = async function (req, res) {
try {
const { href } = new URL(url.parse(req.url, true).query.url);
const browser = await puppeteer.launch();
const page = await browser.newPage();
await page.setViewport({ width: 1024, height: 768 });
#!/bin/bash
declare -a list=("file.spec.ts" "file2.spec.ts" "file3.spec.ts")
for val in ${list[@]}; do
echo "/* eslint-disable @typescript-eslint/no-explicit-any */\n\n$(cat ${val})" > $val
echo $val
done
import type { NextApiRequest, NextApiResponse } from 'next'
import fs from 'fs';
import { createCanvas } from 'canvas'
export default (req: NextApiRequest, res: NextApiResponse) => {
const width = 1200
const height = 630
const canvas = createCanvas(width, height)
const context = canvas.getContext('2d')
@fmontes
fmontes / product.json
Last active March 31, 2020 14:29
DotCMS - Frontend Coding Exercise
{
"hostName": "System Host",
"modDate": "2019-11-07 00:59:20.029",
"image3ContentAsset": "5b4c012a-df7c-4e1d-ab8b-5ee949f1ec0d\/image3",
"image2ContentAsset": "5b4c012a-df7c-4e1d-ab8b-5ee949f1ec0d\/image2",
"description": "<p>For your trophy quest, only the legendary strength and performance of a Penn&reg; International&reg; VIS\/Offshore Angler&trade; Ocean Master&reg; Stand-Up Combo will do. The pairing of the world's premier 2-speed conventional reel and an acclaimed rod with virtually unlimited lifting power gives you the advantage against the biggest game in the sea.<\/p>\n<p>The 6th-generation Penn International VIS Two-Speed Lever Drag Reel gives you a shot at landing the fish of a lifetime. Its Quick-Shift II&trade; system lets you choose between 2 gear ratios &ndash; fast retrieve or low power &ndash; with the push of a button. Features a machined and anodized aluminum Full Metal Body and sideplates, braid-ready spool with line capacity rings, stainless steel gears, and 5 shielded
@fmontes
fmontes / bac-pinpad-statement-process.js
Created October 3, 2019 19:08
[WIP]: Find the payments lines in the BAC pinpad statement, group by date and sum
const full = `
============================================================================================================
|Fecha |Suc |Lote |Liquidaci�n|Descripci�n |D�bitos |Cr�ditos |Pagar |
============================================================================================================
|06/09/2019|00248|98077|00000000000|FACTURACION | |100,050.00| |
|06/09/2019|00248|98077|00000000000|COMISION |2,251.13| | |
|06/09/2019|00248|98077|92572103961|MANTENIMIENTO DE CUENTA |2,312.00| | |
|06/09/2019|00248|98077|92572103961|PAGO EN BANCO SAN JOSE | | | 95,486.88|
|07/09/2019|00248|45262|00000000000|FACTURACION | |387,250.00| |
|07/09/2019|00248|45262|00000000000|COMISION |8,713.13| | |
@fmontes
fmontes / face-mock.ts
Last active August 24, 2019 17:54
Model for my Angular Face Recognition Workshop
face: Face = {
attributes: {
emotion: {
sadness: 2.604,
neutral: 0.004,
disgust: 0.355,
anger: 0.001,
surprise: 0.004,
fear: 0.001,
happiness: 97.032
[
{
"divider": {
"clazz": "com.dotcms.contenttype.model.field.ImmutableRowField",
"fieldContentTypeProperties": [],
"dataType": "SYSTEM",
"searchable": false,
"unique": false,
"indexed": false,
"listed": false,

Keybase proof

I hereby claim:

  • I am fmontes on github.
  • I am fmontes (https://keybase.io/fmontes) on keybase.
  • I have a public key ASDXVnioW1NCen6RxtgYVAeFYt3WR9g8_YMeR8ucc8T7bAo

To claim this, I am signing this object:

@fmontes
fmontes / find_replace.js
Created August 23, 2018 18:15
Find and replace text in a webpage
// Find all the existence of a text:
var headings = document.evaluate("//h4[contains(., 'String of text')]", document, null, XPathResult.ANY_TYPE, null );
// Get one element
var el = headings.iterateNext();
// Replace the text
el.innerText = 'New text'
<Context path="${catalina.home}/webapps/ROOT" docBase="${catalina.home}/webapps/ROOT" reloadable="false" crossContext="true">
<JarScanner scanBootstrapClassPath="false" scanClassPath="false">
<JarScanFilter tldSkip="*.jar" pluggabilitySkip="*.jar"/>
</JarScanner>
<Resources allowLinking="true" />
<!--
The class loader behaviour changed on recent tomcat versions, with the new default behaviour
we are unable to set a -javaagent and with that we won't be able to use instrumentation, setting the
delegate to true will restored the loader behaviour.
"Set to true if you want the class loader to follow the standard Java2 delegation model,