Skip to content

Instantly share code, notes, and snippets.

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

Luis Alfredo Porras Páez lporras

🏠
Working from home
View GitHub Profile
@lporras
lporras / compress.js
Created May 3, 2024 22:26
Compress Image Imagemagick
// npm install imagemagick
const fs = require('fs');
const { exec } = require('child_process');
// Function to compress PNG using ImageMagick
function compressPNG(inputFile, outputFile, quality = 80) {
const command = `convert ${inputFile} -quality ${quality} ${outputFile}`;
exec(command, (error, stdout, stderr) => {
@lporras
lporras / create_buckets.ts
Created October 6, 2023 15:08
Create Buckets in s3 with CloudFormation
import * as cdk from 'aws-cdk-lib';
import { CfnOutput } from 'aws-cdk-lib';
import { Bucket, CfnBucket } from 'aws-cdk-lib/aws-s3';
import { Construct } from 'constructs';
class L3Bucket extends Construct {
constructor(scope: Construct, id: string, expiration: number){
super(scope, id);
new Bucket(this, id, {
@lporras
lporras / settings.json
Created April 7, 2022 21:56
unnecessary code highlighted
{
"workbench.colorCustomizations": {
"editorUnnecessaryCode.border": "red"
}
}
@lporras
lporras / CSV JSON.md
Last active March 11, 2020 09:52
CSV JSON Example
id,name,email
1,luis,luis@gmail.com
2,juan,juan@gmail.com
[
  { id: "1", name: "luis", email: "luis@gmail.com"},
 { id: "2", name: "juan", email: "juan@gmail.com"}
@lporras
lporras / desarrollador_fullstack_semi_senior.md
Created October 3, 2019 18:34
Desarrollador Full-Stack Ruby on Rails Webdox

Nombre empresa: Webdox

Puesto Ofrecido: Desarrollador Full-Stack

Perfil Requerido:

Buscamos desarrolladores Web que cumplan con los sgtes requisitos:

  • Al menos 2 años de experiencia.
  • Experiencia en Ruby on Rails.
  • Familiarizado con librerías y frameworks de desarrollo Frontend (React, Vue, Angular).

Easy steps for CPU profiling a Rails app

  1. add ruby-prof to your gemfile (https://github.com/ruby-prof/ruby-prof)
  2. grab kcachegrind or qcachegrind (brew install qcachegrind graphviz on os x)
  3. plop development_profiler.rb in lib in your app
  4. wrap your questionable code in a prof block
  5. open the file in qcachegrind
@lporras
lporras / profiling-example-image.png
Last active August 7, 2019 16:15
Profiling with Ruby-Prof
profiling-example-image.png
@lporras
lporras / fetch-chunked.js
Created July 5, 2019 14:51 — forked from jfsiii/fetch-chunked.js
Quick example of using fetch to parse a chunked response
var chunkedUrl = 'https://jigsaw.w3.org/HTTP/ChunkedScript';
fetch(chunkedUrl)
.then(processChunkedResponse)
.then(onChunkedResponseComplete)
.catch(onChunkedResponseError)
;
function onChunkedResponseComplete(result) {
console.log('all done!', result)
}
<html>
<body>
<h2>Privacy Policy</h2>
<p>ICI-Santiago built the Gedeon app as a open source app. This SERVICE is provided by ICI-Santiago at no cost and is intended
for use as is.</p>
<p>This page is used to inform website visitors regarding our policies with the collection, use, and
disclosure of Personal Information if anyone decided to use our Service.</p>
<p>If you choose to use our Service, then you agree to the collection and use of information in
relation with this policy. The Personal Information that we collect are used for providing and
improving the Service. We will not use or share your information with anyone except as described
@lporras
lporras / logstash_example.conf
Last active May 3, 2019 17:19
example logstash 1
input {
file {
path => "/Users/luisalfredoporraspaez/apps/elk_course/datos.json"
start_position => "beginning"
codec => "json"
}
}
filter {
mutate {