Skip to content

Instantly share code, notes, and snippets.

View ludo237's full-sized avatar
🇮🇹
Life is good when you have a good sandwich

Claudio Ludovico ludo237

🇮🇹
Life is good when you have a good sandwich
View GitHub Profile
@ludo237
ludo237 / prune-branches.sh
Created September 6, 2018 16:13
Delete all branches but keep master
git branch | grep -v "master" | xargs git branch -D
@ludo237
ludo237 / Assertions.php
Created March 7, 2018 15:11
Laravel PHP custom assertions
<?php
namespace Tests\Utils;
use Ramsey\Uuid\Uuid;
/**
* Trait Assertions
* @package Tests\Utils
*/
@ludo237
ludo237 / roundForHumans.php
Last active April 6, 2017 09:19
Round numbers in order to have something more human readable
<?php
/**
* Round a number into an human readable number
*
* The idea is to converts numbers like 999,999 into something like 0.9M or 999.99K
* using the scientific notation.
*
* @param $number
*
* @return string
@ludo237
ludo237 / wslps.ps1
Created October 11, 2016 13:10
Enable WSL using Poweshell
Enable-WindowsOptionalFeature -Online -FeatureName Microsoft-Windows-Subsystem-Linux
@ludo237
ludo237 / init-tests.sh
Created July 4, 2016 16:27
Simple bash that allows to autorun a test suite for Laravel
#!/bin/bash
clear
echo "---------------------------------"
echo "---- Automatic Tester -----"
echo "---- -----"
echo "---- v1.4 -----"
echo "---------------------------------"
echo "==> Testing if PHP is on Version 7.0+..."
@ludo237
ludo237 / happybday.sh
Created April 15, 2016 08:41
Automate Happy B. Day
sh /home/YourUser/saints.sh | mutt -s "Happy Birthday! <3" [email protected]
@ludo237
ludo237 / ArrayPushAssoc.php
Created February 2, 2016 08:19
Array Push Hack
<?php\
/**
* array_push_assoc is a moch-up of the standard core.php Array Push
* @param array $array
* @param object $key
* @param object $value
* @return array $array
*/
public function array_push_assoc(&$array, $key, $value){
// Simply insert the key and the value into the array
@ludo237
ludo237 / myip.sh
Created June 4, 2015 07:37
Grab all networks and show the associated IP
# -------------------------------------------------------------------
# myIP address
# -------------------------------------------------------------------
function myip() {
ifconfig lo0 | grep 'inet ' | sed -e 's/:/ /' | awk '{print "lo0 : " $2}'
ifconfig en0 | grep 'inet ' | sed -e 's/:/ /' | awk '{print "en0 (IPv4): " $2 " " $3 " " $4 " " $5 " " $6}'
ifconfig en0 | grep 'inet6 ' | sed -e 's/ / /' | awk '{print "en0 (IPv6): " $2 " " $3 " " $4 " " $5 " " $6}'
ifconfig en1 | grep 'inet ' | sed -e 's/:/ /' | awk '{print "en1 (IPv4): " $2 " " $3 " " $4 " " $5 " " $6}'
ifconfig en1 | grep 'inet6 ' | sed -e 's/ / /' | awk '{print "en1 (IPv6): " $2 " " $3 " " $4 " " $5 " " $6}'
}
@ludo237
ludo237 / .htaccess
Last active December 11, 2024 14:30
The ultimate .htaccess file. Please feel free to fork it, edit it and let me know what do you think about it.
# Apache configuration file
# httpd.apache.org/docs/2.2/mod/quickreference.html
# Note .htaccess files are an overhead, this logic should be in your Apache
# config if possible: httpd.apache.org/docs/2.2/howto/htaccess.html
# Techniques in here adapted from all over, including:
# Kroc Camen: camendesign.com/.htaccess
# perishablepress.com/press/2006/01/10/stupid-htaccess-tricks/
# Sample .htaccess file of CMS MODx: modxcms.com
# This is the free sample of .htaccess from 6GO s.r.l.
# @author Claudio Ludovico Panetta (@Ludo237)
@ludo237
ludo237 / palindrome.adb
Last active September 28, 2015 02:38
Palindrome in ADA
with Ada.Text_IO, Ada.Integer_Text_IO, Ada.Characters.Handling, Ada.Strings, Ada.Strings.Maps, Ada.Strings.Fixed;
use Ada.Text_IO, Ada.Integer_Text_IO, Ada.Characters.Handling;
procedure Palindromi is
Scelta : Integer := 0 ;
procedure Intestazione is
begin
Put_Line("*** Controllo stringa palindroma ***") ;