Skip to content

Instantly share code, notes, and snippets.

View LasaleFamine's full-sized avatar
🔮
Producing

Alessio Occhipinti LasaleFamine

🔮
Producing
View GitHub Profile
@LasaleFamine
LasaleFamine / ngrok-client.service
Created October 12, 2021 10:25
ngrok-client.service for PI
[Unit]
Description=ngrok client
After=network.target
[Service]
ExecStart=/home/pi/ngrok start --all -config /home/pi/.ngrok2/ngrok.yml
Restart=on-abort
[Install]
WantedBy=multi-user.target
@LasaleFamine
LasaleFamine / findFlatByKey.js
Created July 14, 2020 15:25
Find a couple of `key` - `value` within an object. Recursive.
const findFlatByKey = (choosenKey, choosenValue) => (ogg) => {
let found = false;
const step = (object, prev, currentDepth) => {
currentDepth = currentDepth || 1
Object.keys(object).forEach((key) => {
const value = object[key]
const isarray = Array.isArray(value)
const type = Object.prototype.toString.call(value)
const isobject = (
stages:
- test
- build
- deploy
# Prepare the variables we will use on different stages
variables:
IMAGE_TAG: $CI_REGISTRY_IMAGE:latest
IMAGE_TAG_SHA: $CI_REGISTRY_IMAGE:$CI_COMMIT_SHA
SSH_ENTRY: userforvps@yourDigitalOceanVps.com
@LasaleFamine
LasaleFamine / Dockerfile
Created June 21, 2020 21:31
Dockerfile and docker-compose for Strapi + Postgres
FROM strapi/base:12
ARG POSTGRES_USER
ARG POSTGRES_PASSWORD
WORKDIR /srv/app
COPY . ./
COPY ./ci/wait-for-postgres.sh ./
@LasaleFamine
LasaleFamine / nginx-docker-strapi
Created June 21, 2020 21:06
Sample Nginx site config file for Docker-Strapi application
upstream strapi {
server localhost:1337;
## For Docker containers and load balancing
# server node2:3000 weight=10 max_fails=3 fail_timeout=30s;
# server node3:3000 weight=10 max_fails=3 fail_timeout=30s;
}
server {
listen 80;
server_name strapi.yourdomain.com;
access_log /var/log/nginx/strapi.yourdomain.com.log;
@LasaleFamine
LasaleFamine / _service.md
Last active August 11, 2018 14:39 — forked from naholyr/_service.md
Sample /etc/init.d script

Sample service script for debianoids

Look at LSB init scripts for more information.

Usage

Copy to /etc/init.d:

# replace "$YOUR_SERVICE_NAME" with your service's name (whenever it's not enough obvious)

Keybase proof

I hereby claim:

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

To claim this, I am signing this object:

function onElementHeightChange(elm, callback) {
let lastHeight = elm.clientHeight;
let lastScrollY = window.pageYOffset;
let newHeight;
let newScrollY;
(function run(){
newHeight = elm.clientHeight;
if(lastHeight !== newHeight) {
class FrameResizer {
constructor (frameSelector) {
this.frameSelector = frameSelector;
this.iFrame = document.querySelector(this.frameSelector);
this.iFrameOrigin = new URL(this.iFrame.src).origin;
}
_addEvent (element, type, callback) {
return element.addEventListener(type, callback, false);
}
const fs = require('fs');
const vsts = require('vso-node-api');
const repoId = 'YOUR_REPO_ID';
const token = 'YOUR_TOKEN';
const run = async () => {
const writeStream = fs.createWriteStream('./output.zip');
const authHandler = vsts.getPersonalAccessTokenHandler(token);
const handler = new vsts.WebApi('https://<username>.visualstudio.com/defaultcollection', authHandler);