Skip to content

Instantly share code, notes, and snippets.

Antoine 2ec0b4

Block or report user

Report or block 2ec0b4

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@2ec0b4
2ec0b4 / watch.sh
Created Feb 27, 2019
Watch for file changes and do something
View watch.sh
#!/bin/bash
# This script requires [entr](http://entrproject.org): `brew install entr`
# Tested on macOS Mojave
while true; do
# Watch for files changes or new files in the current directory, except in ./dist, ./vendor and ./.git, and execute ./do-something.sh
find . \( -path "./dist" -o -path "./vendor" -o -path "./.git" \) -prune -o -print | entr -d ./do-something.sh
done
@2ec0b4
2ec0b4 / deploy.md
Last active Jan 9, 2018
Déploiement avec Capistrano
View deploy.md

Déploiement avec Capistrano

Le déploiement est lancé depuis une box Vagrant disposant de Ruby >= 2.0. Dans le gestionnaire de paquets RubyGem, il faut penser à ajouter capistrano.

Configuration sur le serveur distant

Pré-requis

  • Git
@2ec0b4
2ec0b4 / modele.php
Last active Jun 20, 2019
Récupère le modèle d'un véhicule à partir d'un numéro de plaque d'immatriculation française
View modele.php
#!/usr/bin/php -q
<?php
if( !isset($argv[1]) ) {
showError("Pose ta plaque en paramètre, frère !");
exit;
}
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => "https://tesla.oscaro.com/xhr/dionysos-search/fr/fr?plate=".$argv[1],
CURLOPT_RETURNTRANSFER => true,
@2ec0b4
2ec0b4 / Vagantfile
Created Apr 20, 2016
vagrant push staging
View Vagantfile
Vagrant.configure('2') do |config|
config.push.define "staging", strategy: "ftp" do |push|
push.host = "staging.dev"
push.passive = false
push.secure = true
push.username = "user"
push.password = "password"
push.destination = "/var/www/staging/"
push.dir = "./html/"
end
@2ec0b4
2ec0b4 / myservice
Last active May 8, 2017 — forked from bramus/myservice
Running a PHP script as a service/daemon using `start-stop-daemon`
View myservice
#! /bin/sh
# Installation
# - Move this to /etc/init.d/myservice
# - chmod +x this
#
# Starting and stopping
# - Start: `service myservice start` or `/etc/init.d/myservice start`
# - Stop: `service myservice stop` or `/etc/init.d/myservice stop`
@2ec0b4
2ec0b4 / lights.climagic.sh
Created Nov 21, 2015
KITT grill visual from Knight Rider
View lights.climagic.sh
#!/bin/bash
vNbLights=9
vWidth=3
vSleep=0.5
function sendRequest() {
nc -w0 -u lights.climagic.com 45444 <<< $1
}
View convert-bytes.php
<?php
/**
* Convert bytes
* @param int|string $bytes
* @return mixed returns an array with the converted value and a label key (see $unit)
*/
function convert_bytes($bytes)
{
$unit = array(
@2ec0b4
2ec0b4 / last-modified-files.sh
Created Nov 1, 2014
Find the 10 last modified files of a directory
View last-modified-files.sh
#!/bin/bash
cd /path/to/dir/
find . -type f -print0 | xargs -0 stat -f "%m %N" | sort -rn | head -10 | cut -f2- -d" "
# or with modification time
find . -type f -print0 | xargs -0 stat -f "%m %t%Sm %N" | sort -rn | head -10 | cut -f2-
@2ec0b4
2ec0b4 / change-permissions.sh
Created Nov 1, 2014
Recursively change the access permissions to directories and files
View change-permissions.sh
#!/bin/bash
cd /path/to/dir/
find . -type d -exec chmod 755 {} +
find . -type f -exec chmod 644 {} +
You can’t perform that action at this time.