Skip to content

Instantly share code, notes, and snippets.

@dsferruzza
dsferruzza / gist:6069617
Last active December 20, 2015 04:19
AngularJS: resources that handle PUT call for modifications
// Inspired from: http://kirkbushell.me/angular-js-using-ng-resource-in-a-more-restful-manner/
var resource = angular.module('Resource', ['ngResource']);
resource.factory('Resource', ['$resource', function($resource) {
return function(url, params, methods) {
var defaults = {
update: { method: 'put', isArray: false },
create: { method: 'post' }
};
@dsferruzza
dsferruzza / gist:9529264
Created March 13, 2014 14:13
Draft of AST for simpleSqlParser
/*
SELECT t1.col1, t2.col2 AS c2, NOW() AS "current time"
FROM table1 AS t1
LEFT JOIN table2 AS t2 ON t1.id = t2.id_table1
WHERE t1.col1 > 0 AND t1.col1 < 50
ORDER BY t2.col2 ASC
LIMIT 10,5
*/
var ast = {
@dsferruzza
dsferruzza / stop-after-this-track.lua
Created June 8, 2014 21:12
This is a Proof Of Concept of a feature I miss in VLC: "stop after this track"
--[[
This is a Proof Of Concept of a feature I miss in VLC: "stop after this track"
This is my first time hacking VLC, so I have some questions:
1) Is "descriptor().description" useful? (I can't find how it is used by VLC)
2) When is "meta_changed()" called and what is it supposed to return?
3) Is there a VLC Lua API's documentation? (I read https://www.videolan.org/developers/vlc/share/lua/README.txt but I had to pick up some stuff from existing extensions on GitHub to get this done)
4) Is there a "standard" way to handle localization?
5) Is it possible to add an entry to the tray icon's context menu? (How?)
@dsferruzza
dsferruzza / gh-pages-creation.sh
Last active August 29, 2015 14:14
Git hook to keep gh-pages branch up to date with master
# This needs to be executed once to create the "gh-pages" branch
git checkout --orphan gh-pages
git rm -rf .
# This is the part to adapt
FILE="site/index.html"
git checkout master -- $FILE
git mv $FILE index.html
git commit -am "First commit"
@dsferruzza
dsferruzza / ArduinoML.scala
Created July 9, 2015 16:56
Arduino Internal DSL in Scala, following the lecture by @petitroll at EJCP2015
case class ArduinoML(transitions: Seq[Transition]) {
def genCode: String = {
val statePrefix = "state_"
val init = transitions.head.from
val bricks = transitions.foldLeft(Set.empty[Brick])((acc, cur) => acc ++ cur.from.actuators ++ cur.to.actuators ++ cur.cond.sensors)
val br = bricks
.map(" " + _.genCode)
.mkString("\n")
@dsferruzza
dsferruzza / default.nix
Last active March 28, 2017 19:42
VeraCrypt for Nixpkgs
{ fetchurl, stdenv, pkgconfig, nasm, fuse, wxGTK30, devicemapper, makeself,
wxGUI ? true
}:
stdenv.mkDerivation rec {
name = "veracrypt-${version}";
version = "1.19";
src = fetchurl {
url = "https://launchpad.net/veracrypt/trunk/${version}/+download/VeraCrypt_${version}_Source.tar.gz";

Keybase proof

I hereby claim:

  • I am dsferruzza on github.
  • I am dsferruzza (https://keybase.io/dsferruzza) on keybase.
  • I have a public key ASDhLMTEJ3pt27CMGGyFX6AzJ88ca2F0bEKll-KSHVWj2go

To claim this, I am signing this object:

@dsferruzza
dsferruzza / Dockerfile
Created November 26, 2019 12:44
Keycloak 8.0.0 on Clever Cloud
FROM jboss/keycloak:8.0.0
ADD run.sh /opt/run.sh
ENTRYPOINT /opt/run.sh
CMD ["-b", "0.0.0.0", "--server-config", "standalone-ha.xml"]

TP : Ajouter une commande de stats dans l’outil de debug de la télémétrie

Contexte

Fonctionnalités

La lib de télémétrie (dans src/software/telemetry/) est une crate Rust qui comporte 2 éléments :

  1. La lib en elle-même (point d’entrée src/lib.rs)

@dsferruzza
dsferruzza / README.md
Last active September 30, 2024 02:32
Configure a memory_limit for scheduled tasks of a Laravel app on Clever Cloud

Problems

  • some of my Laravel's scheduled tasks fail because the default memory_limit of PHP is too low
  • running php -d memory_limit=xxx artisan schedule:run does not seem to have any effect
  • there is no way to provide a custom php.ini for CLI-only on Clever Cloud

Solution

This patch adds a simple way to set memory_limit using a CLI_MEMORY_LIMIT environment variable. This new setting only applies when the Laravel app is booted from CLI (like when running php artisan ... commands) and have no effect on the memory_limit value in web context.