Code By
Lucas Mouilleron

An Open Source selection

PythonScriptLauncher

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

weather

Last update : 13/04/2016 - 18:24

Shity weather script to know if I can ride to work.

Uses forecast.io for weather data and freegeoip.net for IP geoloc.

Screenshot

Install

  • composer install

Config

  • config/config.php
  • config/locations.json (Geocode address : http://mygeoposition.com)

code

Last update : 24/02/2016 - 10:30
Private repository :(

RTreeBoilerplate

Last update : 24/02/2016 - 10:15

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

Run

  • ant getDependencies
  • ant run

Screenshot

reactiveXBoilerplate

Last update : 02/02/2016 - 17:09

JavaRX boilerplate.

Run

  • ant getDependencies
  • ant run

Docs

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

Screenshot

dockerManager

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

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

lucasmouilleron

Last update : 02/12/2015 - 11:58

My personal website.

Screenshot

dockerManagerTest

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

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