Skip to content

Instantly share code, notes, and snippets.

View chamerling's full-sized avatar
🤟

Christophe Hamerling chamerling

🤟
View GitHub Profile
import { useState, useEffect, useCallback } from "react";
import { withWebPerformance } from "./withWebPerformance";
import Loader from "./components/Loader";
export default function SomeComponent() {
const LoaderWithPerformance = withWebPerformance(Loader, "web-perf");
const [loading, setLoading] = useState(true);
// ...
// TODO: load something and update the loading state
import { ComponentType, useEffect, useRef } from "react";
const withWebPerformance = <
T extends object & { onLoaded?: (measure: PerformanceMeasure) => void }
>(
Component: ComponentType<T>,
name: string
) => {
return (props: T) => {
const { onLoaded } = props;
@chamerling
chamerling / realm-export.json
Created July 31, 2020 10:20
keycloak configuration for openpaas SPA
{
"id": "master",
"realm": "master",
"displayName": "Keycloak",
"displayNameHtml": "<div class=\"kc-logo-text\"><span>Keycloak</span></div>",
"notBefore": 0,
"revokeRefreshToken": false,
"refreshTokenMaxReuse": 0,
"accessTokenLifespan": 60,
"accessTokenLifespanForImplicitFlow": 900,
@chamerling
chamerling / apache2_vhost_config_vuejs_dist
Last active May 13, 2020 07:49 — forked from 7rin0/apache2_vhost_config_vuejs_dist
VueJS: Apache / Nginx vhost config examples
<VirtualHost *:80>
DocumentRoot "/etc/openpaas/isiboard"
ServerName isiboard.local
<Directory /etc/openpaas/isiboard/>
Options Indexes FollowSymLinks MultiViews
AllowOverride all
Require all granted
Order allow,deny
allow from all
<?xml version="1.0" encoding="UTF-8"?>
<gpx creator="StravaGPX" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.topografix.com/GPX/1/1 http://www.topografix.com/GPX/1/1/gpx.xsd http://www.garmin.com/xmlschemas/GpxExtensions/v3 http://www.garmin.com/xmlschemas/GpxExtensionsv3.xsd http://www.garmin.com/xmlschemas/TrackPointExtension/v1 http://www.garmin.com/xmlschemas/TrackPointExtensionv1.xsd" version="1.1" xmlns="http://www.topografix.com/GPX/1/1" xmlns:gpxtpx="http://www.garmin.com/xmlschemas/TrackPointExtension/v1" xmlns:gpxx="http://www.garmin.com/xmlschemas/GpxExtensions/v3">
<metadata>
<time>2020-01-15T07:10:09Z</time>
</metadata>
<trk>
<name>Morning Run</name>
<type>9</type>
<trkseg>
<trkpt lat="43.4843740" lon="3.6764020">
@chamerling
chamerling / docker-compose.yml
Created March 19, 2019 15:47
OpenPaaS 1.4.3 "PROVISION=true docker-compose up"
version: '2'
volumes:
esn_james_conf:
services:
esn:
container_name: esn
image: linagora/esn:1.4.3
@chamerling
chamerling / massive.js
Created January 17, 2019 14:32
Massive user creation for OpenPaaS
// Login into OP as admin, open the browser console and copy/paste this script after having updated the domainId value
// define it from your instance
const domainId = '5bacec0db1a8481f6b30e806';
function getBody(i, domainId) {
return `{"accounts":[{"type":"email","emails":["user-${i}@open-paas.org"]}],"domains":[{"domain_id":"${domainId}"}],"password":"secret"}`;
}
for(var i = 0; i < 1000; i++) {
# install
npm install -g merginator-gitlab
# Use it
merginator-gitlab --upvotes 2 --gitlab https://YOUR_GITLAB_INSTANCE --token 1234567890
const axios = require('axios');
const { from, interval, combineLatest } = require('rxjs');
const { switchMap, pluck, flatMap, distinct, skipWhile, share } = require('rxjs/operators');
const baseURL = process.env.GITLAB_ENDPOINT || 'https://gitlab.com';
const privateToken = process.env.GITLAB_TOKEN;
const pollingInterval = 2000;
const UPVOTES = 2;
const client = axios.create({ baseURL, headers: { 'Private-Token': privateToken }});
const axios = require('axios');
const { from, interval } = require('rxjs');
const { switchMap, pluck, flatMap, distinct, skip, share } = require('rxjs/operators');
const baseURL = process.env.GITLAB_ENDPOINT || 'https://gitlab.com';
const privateToken = process.env.GITLAB_TOKEN;
const pollingInterval = 2000;
const client = axios.create({ baseURL, headers: { 'Private-Token': privateToken }});
function fetchMergeRequests() {