Skip to content

Instantly share code, notes, and snippets.

View liuggio's full-sized avatar

Giulio De Donato liuggio

  • Radical Company
  • London
View GitHub Profile
@liuggio
liuggio / main.go
Last active December 30, 2022 07:17
Golang api code
package main
import (
"database/sql"
"fmt"
"log"
"net/http"
"time"
"os"
"strings"
@liuggio
liuggio / All Your Pull request.md
Last active September 14, 2020 10:05
Your Pull Request timeline

In order to obtain all your Open source Pull-Request history:

  1. Go to Google bigquery and execute the following query replacing liuggio with your GitHub login

  2. execute query

SELECT repository_url, repository_owner, repository_name, count(*) as numberOfPR
FROM [githubarchive:github.timeline]
WHERE payload_pull_request_head_repo_owner_login = "liuggio"
@liuggio
liuggio / BindResult.php
Last active September 27, 2017 10:40
The DTO has its validation, the controller uses the negotiation lib to get the proper formatter (twig or json_encode), the binder validate and fill the dto and create a BindResult
class BindResult {
private $data;
private $errors;
function __construct($data, $errors)
{
$this->data = $data;
$this->errors = $errors;
@liuggio
liuggio / namespace_isolation.go
Last active November 9, 2016 02:24
// go build . // sudo ./c /bin/sh -c "hostname bo;hostname"
package main
import (
"fmt"
"os"
"os/exec"
// "syscall"
)
func main() {

Creare macchina virtuale

$ docker-machine create one -d virtualbox

docker-machine ssh one

edit /var/lib/boot2docker/profile (sotto debian /etc/default/docker)

EXTRA_ARGS='
@liuggio
liuggio / largestfiles.sh
Created November 26, 2013 13:59
largest files and directories
FS='/';NUMRESULTS=20;resize;clear;date;df -h $FS; echo "Largest Directories:"; du -x $FS 2>/dev/null| sort -rnk1| head -n $NUMRESULTS| awk '{printf "%d MB %s\n", $1/1024,$2}';echo "Largest Files:"; nice -n 19 find $FS -mount -type f -ls 2>/dev/null| sort -rnk7| head -n $NUMRESULTS|awk '{printf "%d MB\t%s\n",($7/1024)/1024,$NF}'
@liuggio
liuggio / SwapKeys.md
Last active December 26, 2015 12:29
SwapKeys joke

Swap Keys the funny joke

we are a great team @gianpiero2012 @toretto460 @danieledangeli @claudio-dalicandro

The game consists of inverting 2 keyboard keys both physically and in terms of key-map of your team mate.

It doesn't require root access.

Install

@liuggio
liuggio / .gitignore_global
Last active December 26, 2015 07:19
git init
.idea
# Compiled source #
###################
*.com
*.class
*.dll
*.exe
*.o
*.so
@liuggio
liuggio / generator.php
Last active December 24, 2015 08:29
problem with generator during eval
<?php
// with $this->serializer = $this->getMock('Symfony\Component\Serializer\SerializerInterface');
// the $code content into the eval($code) into phpunit/phpunit-mock-objects/PHPUnit/Framework/MockObject/Generator.php
class Mock_SerializerInterface_ec3da84e implements PHPUnit_Framework_MockObject_MockObject, JMS\Serializer\SerializerInterface
{
private static $__phpunit_staticInvocationMocker;
private $__phpunit_invocationMocker;
public function __clone()
{
<?php
$factory = new FactoryObject();
$this->changeSetEventManager = new EventManager();
$this->changeSet = new ChangeSet($this->changeSetEventManager);
$extractor = new IdentityExtractorFactory();
$extractor->add('Spicci\Github\Entity\Milestone', '\Spicci\Github\IdIdentityExtractor');
$this->identityMap = new IdentityMap($extractor);