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 / README.md
Last active March 25, 2024 19:08
Ubuntu/Debian Offline Repository Creation

Ubuntu/Debian Offline Repository Creation Gist

When I googled how to create my own offline repository of packages for use in an offline Ubuntu/Debian machine, the results were disheartening and the steps to be taken scattered all over the place.

The files within this gist will allow you to:

  • Download specific apt-get packages... with dependencies included!
  • Create a Packages.gz file so that you can add the repository folder you create to the target machine's /etc/apt/sources.list file.

Before using

@jeanlescure
jeanlescure / headless-chrome-ec2.md
Last active September 2, 2023 07:43
How to setup an EC2 instance to run Chrome Headless for usage with Puppeteer

Chrome Headless on EC2

For puppeteer usage

How to setup an EC2 instance to run Chrome Headless for usage with Puppeteer

1. Spin up ubuntu EC2 instance and ssh into it

ssh ubuntu@ec2-3-21-123-234.compute-1.amazonaws.com
@jeanlescure
jeanlescure / TransformationShader.js
Last active August 24, 2023 02:06
ThreeJS: Vertex shader for translating, scaling, and rotating. Fragment shader for adding texture and controlling opacity.
THREE.TransformationShader = {
defines: {},
uniforms: {
"tDiffuse": { type: "t", value: texture },
"opacity": { type: "f", value: 1.0 },
"translationX": { type: "f", value: 1.0 },
"translationY": { type: "f", value: 1.0 },
"translationZ": { type: "f", value: 1.0 },
"scaleX": { type: "f", value: 1.0 },
@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 / MaxCountersOptimized.js
Last active September 24, 2022 17:51
Codility MaxCounters Solution Javascript - 100% score
/*
You are given N counters, initially set to 0, and you have two possible operations on them:
• increase(X) − counter X is increased by 1,
• max counter − all counters are set to the maximum value of any counter.
A non-empty zero-indexed array A of M integers is given. This array represents consecutive operations:
• if A[K] = X, such that 1 ≤ X ≤ N, then operation K is increase(X),
• if A[K] = N + 1 then operation K is max counter.
@jeanlescure
jeanlescure / TapeEquilibrium.js
Last active September 2, 2022 13:57
Codility TapeEquilibrium Solution in Javascript - 100% score
/*
A non-empty zero-indexed array A consisting of N integers is given. Array A represents numbers on a tape.
Any integer P, such that 0 < P < N, splits this tape into two non-empty parts: A[0], A[1], ..., A[P − 1] and A[P], A[P + 1], ..., A[N − 1].
The difference between the two parts is the value of: |(A[0] + A[1] + ... + A[P − 1]) − (A[P] + A[P + 1] + ... + A[N − 1])|
In other words, it is the absolute difference between the sum of the first part and the sum of the second part.
*/
@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
@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.

Arch Linux clear DNS cache

nscd -K; nscd

Chrome Kiosk for OBS

google-chrome-stable --app=https://obs.ninja/?view=Abcd123 --user-data-dir=/tmp --kiosk