Skip to content

Instantly share code, notes, and snippets.

View gnutix's full-sized avatar

Dorian Villet gnutix

View GitHub Profile
@gnutix
gnutix / README.md
Last active April 17, 2024 18:36
Install a Raspberry Pi as a torrent download station (09.2019)
@gnutix
gnutix / Fixture.yml
Last active March 14, 2024 04:53
Custom Faker Provider for generating Symfony encoded password using UserPasswordEncoderInterface.
Symfony\Component\Security\Core\User\User:
member:
__construct: ['member', '<symfonyPassword("Symfony\Component\Security\Core\User\User", "member", "salt")>', ['ROLE_USER']]
admin:
__construct: ['admin', '<symfonyPassword("Symfony\Component\Security\Core\User\User", "admin", "salt")>', ['ROLE_ADMIN']]
@gnutix
gnutix / binary.php
Last active February 25, 2022 16:12
Example of a self-contained, minimalist Symfony Console application
#!/usr/bin/env php
<?php
declare(strict_types=1);
use Imagecow\Image;
use Symfony\Component\Console\Application;
use Symfony\Component\Console\Command\Command;
use Symfony\Component\Console\Input\InputArgument;
use Symfony\Component\Console\Input\InputInterface;
@gnutix
gnutix / DoctrineDbalStatementInterface.php
Created December 2, 2013 09:07
Mock Builder for Doctrine EntityManager / Connection mock objects.
<?php
namespace Mocks;
use Doctrine\DBAL\Driver\Statement;
/**
* Doctrine DBAL Statement implementing \Iterator.
*
* This class has been created because of a bug in PHPUnit Mock Objects.
<?php
$deals = [
1 => ['forfait' => 60, 'km' => 0.12],
2 => ['forfait' => 0, 'km' => 0.6],
];
foreach ($deals as $deal => $dealData) {
echo 'Deal '.$deal.': forfait '.($dealData['forfait'] === 0 ? 'gratuit' : 'de '.$dealData['forfait'].'.-').' et '.
($dealData['km'] * 100).' cts le kilomètre.'.PHP_EOL;
}
@gnutix
gnutix / command_line.sh
Created September 21, 2020 12:59
Extracting the totals in your Tinder's profile data (number of likes, passes, messages sent, received, etc) from https://account.gotinder.com/data
for i in "app_opens" "swipes_likes" "swipes_passes" "matches" "messages_sent" "messages_received"; \
do jq --arg DATA "$i" -n 'reduce (inputs.Usage[$DATA] | to_entries[]) as {$key, $value} ({}; .[$DATA] += $value)' data.json; \
done
# Outputs :
# {
# "app_opens": ...
# }
# {
function isNotEmpty(value) {
return value !== undefined && value !== null && value !== "";
}
$(function() {
var customDataSource = new DevExpress.data.CustomStore({
key: "ID",
load: function(loadOptions) {
var d = $.Deferred();
var params = {};
$(function() {
var db = DevExpress.data.AspNet.createStore({
key: "ID",
loadUrl: '/my/route/endpoint'
});
$("#gridContainer").dxDataGrid({
dataSource: {
store: db
},
height: "100%",
@gnutix
gnutix / taxi_start.md
Created June 15, 2020 06:34
Investigation around the behavior of liip/taxi start/stop commands

taxi start

Use case 1 : no previous entries

Given :

27/05/2020
@gnutix
gnutix / crash1.log
Last active November 28, 2019 23:01
Sonarr v3 crash
Nov 28 23:43:56 raspbian mono[5032]: [Info] OwinHostController: Listening on the following URLs:
Nov 28 23:43:56 raspbian mono[5032]: [Info] OwinHostController: http://*:8989/
Nov 28 23:44:09 raspbian mono[5032]: [Info] SonarrBootstrapper: Starting Web Server
Nov 28 23:44:39 raspbian mono[5032]: * Assertion at mini-arm.c:3817, condition `ji' not met
Nov 28 23:44:39 raspbian mono[5032]: =================================================================
Nov 28 23:44:39 raspbian mono[5032]: Native Crash Reporting
Nov 28 23:44:39 raspbian mono[5032]: =================================================================
Nov 28 23:44:39 raspbian mono[5032]: Got a SIGABRT while executing native code. This usually indicates
Nov 28 23:44:39 raspbian mono[5032]: a fatal error in the mono runtime or one of the native libraries
Nov 28 23:44:39 raspbian mono[5032]: used by your application.