Skip to content

Instantly share code, notes, and snippets.

View BasileTrujillo's full-sized avatar

Basile Trujillo [L0gIn] BasileTrujillo

  • Montpellier
View GitHub Profile
@BasileTrujillo
BasileTrujillo / generateCombinations.ts
Created March 31, 2021 14:03
Generate all item combinations from an array
/**
* Generate all item combinations
* Go from
* ["a", "b", "c"]
* to
* [
* [ 'a' ],
* [ 'b' ],
* [ 'a', 'b' ],
* [ 'c' ],
@BasileTrujillo
BasileTrujillo / timezoneValidationBenchmark.js
Last active February 25, 2021 09:56
Timezone validation benchmark - Moment VS Vanilla VS Lodash
import moment from 'moment-timezone';
import indexOf from 'lodash/indexOf';
const timezones = moment.tz.names();
const LOOP = 999;
console.time('Vanilla - Flipped');
// Build a flipped array with the timezone value as keys
// This is a performance trick to avoid calling .includes() on a huge array
@BasileTrujillo
BasileTrujillo / build.yml
Created May 25, 2020 10:07
Add [skip ci] support to github action
name: my CI github action
on:
push:
branches:
- master
jobs:
build:
if: "!contains(github.event.head_commit.message, 'skip ci')"
@BasileTrujillo
BasileTrujillo / aws-eb-java-springboot-issue.txt
Created November 28, 2017 07:49
AWS EB JAVA ISSUE - Java SE Platform - Springboot Executable Jar - 'x' extra bytes in unzip
_____________ANSWER_______________
If anyone finds this having a similar problem, we solved this problem by making changes to the pom file of the project to remove:
<executable>true</executable>
and
change <goal>repackage</goal> to <goal>build-info</goal>
@BasileTrujillo
BasileTrujillo / loopCurlWithFlushCache.sh
Created October 25, 2017 14:03
MacOS loop curl with flush cache
#!/bin/bash
while true;
do
sudo dscacheutil -flushcache;
sudo killall -HUP mDNSResponder;
curl https://www.google.fr
echo ""
sleep 1
done
@BasileTrujillo
BasileTrujillo / docker-cleanup.cron
Created July 19, 2017 08:10
Nightly docker cleanup crontab
# Delete all stopped containers and untagged images.
0 0 * * * docker rm $(docker ps -a -q) && docker rmi $(docker images -q -f dangling=true)
# Delete orphaned volumes (in Docker 1.9 and up)
0 0 * * * docker volume ls -qf dangling=true | xargs -r docker volume rm
# Cleanup all residual internal docker cache such as /var/lib/docker/overlay (or /var/lib/docker/overlay2)
0 0 * * * docker system prune -a -f
@BasileTrujillo
BasileTrujillo / mount_s3_to_ec2.md
Last active July 5, 2017 14:05
Mount an S3 Bucket as Linux drive on EC2

NodeJS Tips

Here is a collection of useful tips, links and extra...

Create a new NPM project

Create a new project

$ npm init
@BasileTrujillo
BasileTrujillo / main.tf
Created April 19, 2017 07:30
Terraform template_file local rendering
################################################################################################################
## Configure the user-data template file
################################################################################################################
data "template_file" "user_data" {
template = "${file("${path.module}/user_data.tpl")}"
vars {
foo = "bar"
}
}