Code By
Lucas Mouilleron

61 projects - An Open Source selection

+ PythonScriptLauncher

Python 100%
Last update : 22/08/2016 - 15:18

PSL : A simple python script launcher with global params overridance.

Screenshot

Concept

  • It happens you need to run some scripts in a row
  • It happens as well you need to run a script with different params contexts
  • PSL allows to launch scripts and externally override global params
  • In a script, lib.PSLUpdateGlobalsFromEncodedCallArgs() hooks PSL in (previously defined global params can be potentially overriden)
  • From a launcher script, lib.PSLLaunch(scriptFile, scriptArgs, globalParams) will launch the script scriptFile, with args scriptArgs, and will override global params with globalParams
  • globalParams is a dictionnary of global params :
    • The keys are the name of a script global params
    • If the global param is not defined in the script, no failure
    • If the the global param is defined in the script :
      • If it is a dictionnary, the dics are merged
      • If not, the value is overriden
  • The globalParams are actually sent to the script as a base64 encoded string as the named arg --updateGlobals
  • In PSLed script, the global params are updated with inspect.currentframe()

Demo implementation

  • scriptLauncher.py is the launcher script
  • scriptX.py are test launched scripts
  • params.json is defining groups of runs
  • A run is a python script + its global params overridances
  • Tests:
    • Manual / traditionnal launching : python script1.py
    • PSL lauching on all groups : python scriptLauncher.py all
    • PSL lauching on a specific group : python scriptLauncher.py smalls

Installation

  • python 3
  • pip install -r requirements.txt

+ RTreeBoilerplate

Java 100%
Last update : 24/02/2016 - 10:15

RTree tests.
Based on https://github.com/aled/jsi

Run

  • ant getDependencies
  • ant run

Screenshot

+ reactiveXBoilerplate

Java 100%
Last update : 02/02/2016 - 17:09

JavaRX boilerplate.

Run

  • ant getDependencies
  • ant run

Docs

  • http://reactivex.io/documentation/observable.html

Screenshot

+ dockerManager

PHP 99.1% - Shell 0.9%
Last update : 04/12/2015 - 20:22

dockerManager is a local and remote Docker deployment tool for git versionned projects.
Ideal for web agency testing.

Screenshot

Concepts

  • Local and remote Docker deployment for github projects
  • Project ports and shared folder configuration
  • Project environment variable for runtime environment context (and not at buildtime)
  • Project add wizard (auto port offseting)
  • Export containers files or folders of projects to the dockerManager host (see exportCommnds and exportFilesAndFolders)

Installation

  • Install Docker on target hosts (on MacOS, install docker-machine and install a machine named config/config.json > defaultDockerMachineName)
  • Install php and composer
  • Create ssh key : ssh-keygen -f ./config/id_rsa and then give to repository provider (eg. github)
  • composer install
  • Edit config/config.json if needed
  • bin/dm install

Project compliancy

  • Dockerfile must be in PROJECT_ROOT/docker folder
  • Project should be cloned at the runtime of the docker container. The revision is passed in the REVISION env variable.
  • Project environment variable is by default passed in the ENVIRONMENT env variable, which can be override in project configuration attribute environmentVariable
  • Containers are ran as daemons
  • Containers should not expose ports above config/config.json > publicAutoPortOffset

  • Project github.com:lucasmouilleron/dockeranagerTest can be used for reference

  • Projects are configured in config/projects.json

Local VS Remote deployment

  • Target deployment hosts are defined per project in config/config.json > URI
  • Project can be deloyed localy :"URI":"local"
  • Or remotely : "URI":"user@host"
  • In the case of remote hosts, make sure to ssh-copy-id the URI so remote calls won't need password typing

How to use

  • bin/dm and follow instructions
  • Run the test project : bin/dm run test, bin/dm run test REVISION_NUMBER
  • API, TODO

Thinking

  • For the Dockerfile and/or the docker container to be able to git clone the project, an ssh key must be provided. One solution is to embed the key in the repository. The key can be then associated to a user account (or to the repository deployment keys, which is a per project configuration) on the git repository provider.
  • On tester / client machines, use /etc/hosts or GasMask or HostMan so the production domain / URL points to the Docker server
  • Webapps : App environment at runtime ?
  • Websites : Avoid absolute urls, so the port is forwarded to the next page.

TODO

  • Explain export
  • Improve dm commands output
  • API :
    • REST
    • tokens
    • start and stop projects
    • list running projects
  • Sharedfolder in buildImage
  • multiple git provider (github, some gitlabs)

+ scalaWithJava

Scala 55.5% - Java 44.5%
Last update : 04/12/2015 - 13:26

Screenshot

Compile

  • mkdir classes
  • scalac -d classes *.scala *.java
  • javac -d classes -classpath $SCALA_HOME/lib/scala-library.jar:target/classes *.java

Run

  • scala -cp classes test.HelloWorld

Doc

  • http://www.codecommit.com/blog/scala/joint-compilation-of-scala-and-java-sources
  • http://stackoverflow.com/questions/28158173/building-a-project-with-mixed-scala-and-java-source-files-using-ant-illegal-cy

+ dockerManagerTest

PHP 72.5% - Shell 27.5%
Last update : 26/11/2015 - 09:21

Test project for the dockerManger project : https://github.com/lucasmouilleron/dockerManager

Screenshot

Notes

  • This a simple web server container which serves a simple index.html file.
  • The docker/id_rsa* key has been added to the github project deployment keys so it can be deployed from the Dockerfile. In production, use private repositories and assoiate ssh keys to git provider (eg github) user account.

Tests

  • From dockerManager
  • Build and run : cd docker, docker build -t test . and docker run -ti -p 8090:80 test

+ nodeWebkitBoilerplate

JavaScript 46.2% - HTML 40% - CSS 13.8%
Last update : 23/11/2015 - 17:02

A NW.js boilerplate.
Grunt building and packaging.
The sample app is not relevant (old requirejs + angular test).

Screenshot

Architecture

  • src : the app
    • index.html : entry point
    • package.json : node webkit manifest
    • assets : app assets (css + images)
    • app : logic app files
  • _build : grunt builder

Install

  • Install NodeJS : http://nodejs.org/download
  • sudo npm install bower -g
  • sudo npm install grunt -g
  • cd _build
  • npm install : installs node modules of the builder
  • grunt install : installs the app dev kit (requires password on mac os to extend open files limit)

Run

  • cd _build && grunt run
  • Debug :
    • Edit package.json
    • Change window->toolbar to true
    • Then run and click on the gear

Package

  • Config target platforms in _build/config.json ("platforms":["win", "osx"])
  • cd _build && grunt package

Demo app specific operations

  • Add a node module from npm :
    • cd src && npm install the_module --save-dev
    • Then, use with require("the_module") in the app code
  • Add a requirejs module from bower :
    • cd src && bower install the_module --save
    • Then, add path to js/libs/vendor/the_module/path/to/jsFile in app/main.js in path section and include module name in the requirejs call

Thanks

  • Thanks to the Node Webkit team @ https://github.com/rogerwang/node-webkit
  • Thanks to Joel Grenon for https://github.com/jgrenon/angular-desktop-app

+ sparkBoilerplate

Java 100%
Last update : 23/11/2015 - 16:57

A simple Spark REST boilerplate.

Screenshot

Install

  • Install JDK 8
  • Install Apache Ant
  • Install Apache Ivy
  • Get dependencies : an getDependencies

Run and test

  • Run : ant run
  • https://localhost:8087/hello

Authentication

  • JWT
  • Generate keys :
    • Private key : openssl genrsa -out private_key.pem 2048
    • Private key java format : openssl pkcs8 -topk8 -inform PEM -outform DER -in private_key.pem -out private_key.der -nocrypt
    • Public key java format : openssl rsa -in private_key.pem -pubout -outform DER -out public_key.der
  • Get token : curl -k https://localhost:8080/login/ilovekate
  • Acces restricted area : curl -k --header "token: eyJhbGciOiJSUzI1NiJ9.eyJuYW1lIjoidXNlcm5hbWUiLCJkYXRlIjoxNDQzNzgwODU3NDcyfQ.A6b6Hg1QyYgYUV8J9wff6SvclX90Ydmx6sd8OzTAXYJ6gLpkXMBaHvOLtyxu35hSiiVwrOljnfLSg__tlbzh6PG8KrMuezwCQHttnQzowfp5CxNWM5mEXcMjHiCMLGW3X_p5MV6hm7pe7M8aBDKlZj__OHEMPogFGSga5HhnRDnRfzY49cW9CgzdtfCY3c-wWwabyoy75kQTk5GG2KUOZPy5xKT9EJvL1JLlGKkCl4Il8zNGm2cpP68_hIqCohLqEfbMXjBdccYU7DsjQowBxtjQcZD92pu-6rHKhWcJVlNC32BqvPQXn5laKCm9Dpq703Km_IWvEPz0LPXDtIZ9Gg" https://localhost:8080/protected

SSL

  • Generate keystore :
    • keytool -genkey -keyalg RSA -alias sparkBoilerplate -keystore keystore -validity 3600 -keysize 2048
    • "What is your first and last name?" has to be the domain name
  • Self signing : keytool -export -alias sparkBoilerplate -file certificate.crt -keystore keystore
  • CA signing :
    • Generate CSR (certificate request) : keytool -keystore keystore -certreq -alias sparkBoilerplate -keyalg rsa -file certificate.csr
    • Get from CA the certificate.crt file
  • Generate trustore : keytool -import -file certificate.crt -alias sparkBoilerplate -keystore truststore
  • Test keystore : keytool -list -v -keystore keystore
  • In this boilerplate, password is password and host is localhost

+ picoBoilerplate

JavaScript 90.6% - PHP 5.9% - HTML 2.1% - CSS 1.3% - ApacheConf 0%
Last update : 23/11/2015 - 15:49

picoCMS is a lightweight flat file CMS.

Screenshot

Features

  • A nice picoCMS web boiler plate
  • Stack : picoCMS, twig, scss, requirejs, bootstrap, fontawesome
  • Build : install, build, watch, composer, grunt, bower

Install requirements

  • Install NodeJS : http://nodejs.org/download
  • sudo npm install bower -g
  • sudo npm install grunt -g
  • sudo gem install sass
  • sudo gem install --pre sass-css-importer
  • Install composer :
    • curl -sS https://getcomposer.org/installer | php
    • mv composer.phar /usr/local/bin/composer

Install

  • curl -sS https://getcomposer.org/installer | php && composer install (or php composer.phar install)
  • npm install

Build

  • Edit the package.json file
  • grunt build to build everything
  • grunt watch:scripts while coding

Browserify, CommonJS, dependencies

  • Browserify is used to compile the app
  • If module is not CommonJS, use browserify-shim (for shimming and deps) and browser (for aliases) in package.json
  • If module is not available via bower or npm, use napa

Pico plugins

  • myMetas :
    • adds custom metas in contents
    • metas defined in config.php
  • myNavigation :
    • adds custom navigation to templates
    • users meta status wehter to display or not a page (draft is hidden, default status is published)
    • uses meta order (number)
  • myTags :
    • adds tags to content
    • tags.html template must be defined to list all tags (use {% for tag, tagPages in tags %})
    • tag.html template must be defined to list all pages of a tag (use {% for page in pages %} and {{ meta.currentTag }})
  • myPlugin :
    • example of a plugin running only on a template (on before_render, test $template)

Admin

  • ftp and edit content files

Credits

Thanks to guys at http://picocms.org for their great CMS

+ thirdPartyServices

PHP 99.7% - JavaScript 0.2% - CSS 0.1% - ApacheConf 0%
Last update : 23/11/2015 - 15:46

(Non :)) exhaustive guidelines, tips and tests for (more or less) popular third party services.
Includes : Facebook, Twitter, Instagram, Youtube, and more.

Motivations

Guidelines, tips and tests for (more or less) popular third parties services.
The goal is to help integrate these services in digital campaigns or services.

Guidelines and tips

Gudelines, good pratices and tips we gathered wandering.

Tests

Some tests have been implemented in web/tests.
Use the navigation to explore them.

Build

  • npm install && grunt build
  • JS : web/assets/js/main.js
  • CSS : web/assets/css/scss/main.scss