Skip to content

Instantly share code, notes, and snippets.

View fanf's full-sized avatar

François Armand fanf

View GitHub Profile
@fanf
fanf / .imapfilterSLASHconfig.lua
Created August 28, 2014 14:44
imapfilter config for server with IDLE support
if_dir = os.getenv('HOME') .. '/.imapfilter/'
---------------
-- Options --
---------------
-- time in second before deciding the server timeouted
options.timeout = 120
-- auto-subscribe to new directories
options.subscribe = true
@fanf
fanf / eclipse.ini
Created October 13, 2014 16:57
Eclipse 4.3 config for Scala so that it's not toooooo long
-startup
plugins/org.eclipse.equinox.launcher_1.3.0.v20130327-1440.jar
--launcher.library
plugins/org.eclipse.equinox.launcher.gtk.linux.x86_64_1.1.200.v20140116-2212
-product
org.eclipse.epp.package.standard.product
--launcher.defaultAction
openFile
-showsplash
org.eclipse.platform
@fanf
fanf / keybase.md
Created January 26, 2015 15:03
keybase.md

Keybase proof

I hereby claim:

  • I am fanf on github.
  • I am fanf42 (https://keybase.io/fanf42) on keybase.
  • I have a public key whose fingerprint is 2D8E 8097 A43E D2FD D838 C694 3951 E376 7779 3E7F To claim this, I am signing this object:
{
    "body": {
        "client": {
@fanf
fanf / How-to_multiple_firefox_versions.txt
Last active August 29, 2015 14:14
Install multiple version of Firefox, each with it's own local profil
Start firefox with an other Profile:
-----------------------------------
That will still change things on you user directory (~/.mozilla/firefox/ProfileName)
% ./firefox --no-remote -P ProfileName
Start firefox bypassing the profil manager:
-------------------------------------------
@fanf
fanf / Rudder_API_with_jq.md
Last active August 29, 2015 14:17
Getting list of directive id/technique name, version/name in Rudder API with jq

jq (http://stedolan.github.io/jq/ ) is a fabulous command line tools to post process JSON API response.

Here how you can easely get the list of Rudder API Directive (http://www.rudder-project.org/rudder-api-doc/#api-Directives-listDirectives), whith their id, name, parent Technique and Version:

% curl -k -H "X-API-Token: D6NckZMXawkQAsWTqUJHjsfUnVCY15da" -X GET https://192.168.41.2/rudder/api/latest/directives \
| jq '.data.directives[] | "\(.id) \(.techniqueName)[\(.techniqueVersion)] \(.displayName)"'

returns:

cat active_branches.sh
#!/bin/zsh
BRANCHES="branches/rudder/2.10 branches/rudder/2.11 branches/rudder/3.0 branches/rudder/3.1 master"
== [fanf@luhman16] ~/java/workspaces/rudder-project (master) ==
% cat update-all-all.zsh
#!/bin/zsh
bundle agent permissions_owner_recurse(path, owner, group)
{
methods:
"placeholder" usebundle => permissions_owner_type_recursion("${path}", "${owner}", "${group}", "all", "inf");
}
bundle agent permissions_owner_type_recursion(path, owner, group, type, recursion)
{
vars:
"class_prefix" string => canonify("permissions_owner_${path}");
@fanf
fanf / demo_file_content.cf
Last active August 29, 2015 14:28
Some example of ncf generic methods for Rudder
#####################################################################################
# Copyright 2015 Normation SAS
#####################################################################################
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, Version 3.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
#
# Is this code safe? It seems that it can broke at least at two point:
# - adding in a mutable structure from a parallele processing does not seems to be a good idea
# - throwing an exception for control flow (early out) is kind of acceptable for sequential loop,
# but what happen if two thread of the ".par" processing throw it at the same time ?
# If this is not the good way of doing that, how one process a sequence of things (could be vector
# in place of Seq, the genericity is not really needed here) so that:
# - the processing is parallelized,
# - there is an early out ?
#
def ignoreSomeLinesMatcher[L1 : LinesContent, L2 : LinesContent](): LinesPairComparisonMatcher[L1, L2] = LinesPairComparisonMatcher[L1, L2](
filter = new DifferenceFilter() {
def apply(diffs: (Seq[_], Seq[_])) = {
throw new Exception("OK!")
}
}
)
rootGeneratedPromisesDir must haveSameFilesAs(new File(EXPECTED_SHARE, "root")).withMatcher(ignoreSomeLinesMatcher())