Skip to content

Instantly share code, notes, and snippets.

View glenux's full-sized avatar
Being happy

Glenn Y. Rolland glenux

Being happy
View GitHub Profile
# -*- mode: ruby -*-
# vi: set ft=ruby :
# All Vagrant configuration is done below. The "2" in Vagrant.configure
# configures the configuration version (we support older styles for
# backwards compatibility). Please don't change it unless you know what
# you're doing.
Vagrant.configure("2") do |config|
# The most common configuration options are documented and commented below.
# For a complete reference, please see the online documentation at
#!/bin/sh
set -e
set -u
INPUT="${1:-}"
OUTPUT="${2:-}"
if [ -z "$INPUT" ]; then
echo "ERROR: please give a input file name"
@glenux
glenux / dotenv.php
Last active October 10, 2018 10:40
Helper for PHP sites hosted on servers where environement variables are disabled in apache .htaccess (making mod_env and SetEnv useless)
<?php
// dotenv.php
// A helper script for PHP sites hosted on servers where environement variables
// are disabled in apache .htaccess (making mod_env and SetEnv useless)
// URL: https://gist.github.com/glenux/a727a02614b2d37a963967d1b6759073
function dotenv_file() {
$dotenv = null;
var gulp = require('gulp');
var ts = require('gulp-typescript');
var browserify = require('browserify');
var source = require('vinyl-source-stream');
var tsify = require('tsify');
/* for NODE */
/* gulp.task('default', function() {
#!/usr/bin/env python
import sys
from PySide2.QtWidgets import QApplication, QWidget, QLabel, QVBoxLayout
from PySide2.QtGui import Qt
class HelloApplication(QApplication):
def __init__(self, args):
QApplication.__init__(self, args)
<template>
<div class="header">
<transition name="fade">
<dt-header-search v-if="searchEnable" @search="toggleSearch" />
<dt-header-normal v-else @search="toggleSearch" />
</transition>
</div>
</template>
<script lang="ts">

TP - automatisation du provisionning d'un serveur de wikis

On souhaite utiliser dokuwiki pour créer plusieurs espaces communautaires

  • recettes.wiki
  • politique.wiki

Etapes communes

# -*- mode: ruby -*-
# vi: set ft=ruby sw=2 st=2 et :
SERVERS_COUNT = 2
CLIENTS_COUNT = 1
HOSTS = {}
Vagrant.configure("2") do |config|
config.vm.box = "debian/buster64"
@glenux
glenux / n8n-function-truncate.js
Last active January 23, 2021 17:29
n8n.io Function - Smart text truncate for tweets
let MAX_TWEET_LENGTH = 270;
function naiveCut(str, maxLen){
// Guard
if (str.length <= maxLen) {
return str;
}
return str.slice(0, maxLen-1);
}

TP S1E1 - Automatisation du provisionning d'un serveur de wikis

On souhaite utiliser dokuwiki, une application de Wiki, c'est à dire de gestion collaborative de contenu, pour créer plusieurs espaces communautaires.

  • recettes.wiki
  • politique.wiki

On souhaite utiliser Puppet pour faciliter et automatiser les multiples