Skip to content

Instantly share code, notes, and snippets.

Avatar
🚑
Working 24/7 👍

Samuel Denis-D'Ortun sadortun

🚑
Working 24/7 👍
View GitHub Profile
@sadortun
sadortun / script.js
Created Dec 30, 2020 — forked from bushev/script.js
Remove duplicated files from Moments (Synology NAS)
View script.js
// Very fast-coded deduplication utility. It parses standard "Storage Analyzer" report and moves duplicated files to a separate folder.
// Requires "npm i csv-parse 'move-file"
'use strict';
const path = require('path')
const fs = require('fs')
const parse = require('csv-parse/lib/sync')
const moveFile = require('move-file');
View cleanup-docker.sh
#!/bin/bash
# remove exited containers:
docker ps --filter status=dead --filter status=exited --filter status=created -aq | xargs -r docker rm -v
# remove unused images:
docker images --no-trunc | grep '<none>' | awk '{ print $3 }' | xargs -r docker rmi
# remove unused volumes:
docker volume ls -qf dangling=true | xargs -r docker volume rm
View webhook demo for Google spreadsheet onFormSubmit event
// Simple spreadsheet, with first sheet containing form submission repsonses
// when the form is submitted:
// 1) grab the latest response,
// 2) post it to a third party service via an HTTP POST
function testWebhook() {
var ss = SpreadsheetApp.openById(SPREADSHEET_ID);
var form=ss.getSheets()[0];
var lr=form.getLastRow();
var el=form.getRange(lr,2,1,1).getValue();
var t=el;
@sadortun
sadortun / examples.js
Created Oct 22, 2016 — forked from bryanhelmig/examples.js
EmailPie Samples
View examples.js
// An invalid domain.
// http://emailpie.com/v1/check?email=notreal@example.com
{
"didyoumean": null,
"errors": [
{
"message": "No MX records found for the domain.",
"severity": 7
}
View mamp-xdebug-advanced-php.ini
zend_extension="/Applications/MAMP/bin/php/php5.3.29/lib/php/extensions/no-debug-non-zts-20090626/xdebug.so"
xdebug.coverage_enable=1
xdebug.default_enable=1
xdebug.profiler_enable=1
xdebug.profiler_output_dir="/tmp"
xdebug.remote_autostart=1
xdebug.remote_enable=1
xdebug.remote_host=localhost
xdebug.remote_port=9000
@sadortun
sadortun / magnific-popup-deep-linking.js
Created Oct 28, 2015
Deep Linking with Magnificent popup
View magnific-popup-deep-linking.js
<script type="text/javascript">
function loadGalleryDeepLink()
{
var prefix = "#gallery-";
var h = location.hash;
if (document.g_magnific_hash_loaded === undefined && h.indexOf(prefix) === 0)
View gist:2c764176ed188afa5ba0
<?php
namespace Sonata\Bundle\DemoBundle\Controller;
use Symfony\Bundle\FrameworkBundle\Controller\Controller;
use Sonata\Bundle\DemoBundle\Model\MediaPreview;
use Symfony\Component\HttpFoundation\Request;
class DemoController extends Controller
{