Skip to content

Instantly share code, notes, and snippets.

View jeanlescure's full-sized avatar
🚀
Actively Contributing

Jean Lescure jeanlescure

🚀
Actively Contributing
View GitHub Profile
@jeanlescure
jeanlescure / bpm.pde
Created August 8, 2023 16:35
Interactive BPM tracker using key taps, averaging over N taps for smoother BPM detection in Processing
float bpm = 120;
float minute = 60000;
float interval = minute / bpm;
int time;
int beats = 0;
// Variables for BPM calculation based on key taps
int lastTapTime = 0;
int tapInterval = 0;
@jeanlescure
jeanlescure / cloudfront-default-object.lambda.js
Last active August 28, 2021 20:10
aws s3 api gateway cloudfront lambda@edge function which fixes subdirectory in static website hosting by redirecting "**/" to "**/index.html"
// BASIC
'use strict';
exports.handler = (event, context, callback) => {
// Extract the request from the CloudFront event
const {request} = event.Records[0].cf;
// Extract the URI from the request
const {uri} = request;

Update Java 8

This step is pretty important with the newer release of the Unifi Controller. Starting with version 5.10.x the old Java version that comes with Raspbian isn’t supported anymore. So we are going to replace it with OpenJDK 8.

sudo apt-get install openjdk-8-jre-headless -y

Installing the Unifi Controller Raspberry Pi

So with our Raspberry Pi ready we can start with installing the Unifi Controller on the Raspberry Pi.

@jeanlescure
jeanlescure / .gitignore
Last active October 19, 2021 23:43
My Default Git Ignore File
### Linux ###
*~
# temporary files which can be created if a process still has a handle open of a deleted file
.fuse_hidden*
# KDE directory preferences
.directory
# Linux trash folder which might appear on any partition or disk
WWWWWWWWWWWWWWWWWWWWWWWWWWWWW=:::*WWWWWWWWWWWWWWWWWWWWWWWWWWWWW+:::#WWWWWWWWWWW
WWWWWWWWWWWWWWWWWWWWWWWWWWWWW=:::*WWWWWWWWWWWWWWWWWWWWWWWWWWWWW+:::#WWWWWWWWWWW
WWWWWWWWWWWWWWWWWWWWW++++++++:::::+++*WWWW*+++++++++++*WWWW++++#@@@WWWWWWWWWWWW
WWWWWWWWWWWWWWWWWWWWW:::::::::::::::::WWWW::::::::::::+WWWW::::@WWWWWWWWWWWWWWW
WWWWWWWWWWWW@********:::::::::::::::::****::::::::::::+****::::****@WWWWWWWWWWW
WWWWWWWWWWWW#::::::::::::::::::::::::::::::::::::::::::::::::::::::#WWWWWWWWWWW
WWWWWWWW@###*::::::::::::::::::::::::::::::::::::::::::::::::::::::*###@WWWWWWW
WWWWWWWW*::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::*WWWWWWW
WWWW@@@@*::::::::++++++++++++++++++++++++++++++++++++++++++++++::::::::*WWWWWWW

Creando nuestra primera aplicación “Hola Mundo” con TypeScript

(Fuente: Nube Colectiva)

TypeScript es uno de los lenguajes de Programación que ofrece muchas mejoras de JavaScript, más adelante no se sabe que pasará con JavaScript, puede que TypeScript reemplace oficialmente a JavaScript, esto no significa que JavaScript va quedar de lado, ya que TypeScript esta basado en JavaScript, pero bueno comencemos creando una aplicación inicial para familiarizarnos con el.

TypeScript contiene un superconjunto de métodos, funciones y otras características de JavaScript, si sabes JavaScript se te debe hacer familiar el código de TypeScript.

Desplegando TypeScript

Para mantener el orden crearé un directorio o carpeta con el nombre miappts y luego accedo a este directorio o carpeta que he creado (Estoy usando la consola GitBash)

@jeanlescure
jeanlescure / diff-huge-files.md
Last active November 3, 2020 01:17
Find lines from a huge file which are not present in another even bigger file

Abstract

Say you have a csv backup of a huge database from a week ago (week-old-backup.csv - 3.6GB) and you also have a backup from the same database which is up-to-date (up-to-date-backup.csv - 3.8GB). You would like to generate a file containing only the rows that have been added since that backup from a week ago.

This documents details the fastest way to generate this diff file of huge files in Linux.

What you'll need

a
ac
act
ad
af
ag
age
air
al
als
@jeanlescure
jeanlescure / app.tsx
Created April 29, 2020 18:33
React.js quick dev server on Deno minimal example
import React from 'https://dev.jspm.io/react';
export const App = () => {
return (
<div>Hello React.js quick dev server with Deno example!</div>
);
};
@jeanlescure
jeanlescure / aws_s3_create_react_site_bucket.sh
Last active April 5, 2020 00:12
Bash Script and Policy JSON to create S3 Bucket Website for React.js app using AWS CLI
aws s3 mb s3://my-react-site-bucket
aws s3api put-bucket-acl --bucket my-react-site-bucket --grant-read 'uri="http://acs.amazonaws.com/groups/global/AllUsers"'
aws s3 website s3://my-react-site-bucket --index-document index.html --error-document index.html
aws s3api put-bucket-policy --bucket my-react-site-bucket --policy file://bucket.policy.json