Skip to content

Instantly share code, notes, and snippets.

View loru88's full-sized avatar

Lorenzo loru88

  • Avanti Communications Group
View GitHub Profile
@loru88
loru88 / call-rest-api-script.vbs
Last active May 31, 2024 08:00
How to call a Rest API from Excel VBA script
Dim cache As New Scripting.Dictionary
Sub ChangePartnerName()
Application.ScreenUpdating = False
Dim StartRange As String
Dim EndRange As String
' first row is the header
StartRange = "A2"
@loru88
loru88 / ssh-iptables-tunnel.py
Created March 11, 2019 08:58
SSH port forwarding for IPs without change them to localhost
ADDRESS_TO_FORWARD = [
"1.2.3.4:8088",
]
CLIENT_HOST = "127.0.0.1"
CLIENT_PORT = 4444
REMOTE_HOSTNAME = "user@host"
ip_tables = []
ssh_forward_to = []
@loru88
loru88 / php-cli-xdebug-docker-phpstorm.md
Last active November 29, 2023 09:44
Manually debug PHP CLI inside a Docker container using PHPStorm

to debug a PHP cli script running inside a specific Docker container, you need to find out the the Gateway IP of the docker network your container is attached to.

grab the network name of the running container

$ docker inspect my_container | grep NetworkMode

than grab the gateway IP

<?php
//function definition to convert array to xml
function array_to_xml($array, &$xml_user_info, $name = null) {
foreach($array as $key => $value) {
if(is_array($value)) {
if(!is_numeric($key)){ //just for associative array
array_to_xml($value, $xml_user_info, $key);
}else{ //just for indexed array
$subnode = $xml_user_info->addChild($name);
@loru88
loru88 / soap.php
Created November 28, 2017 13:55
SOAP in PHP
<?php
/**
* http://php.net/manual/en/soapclient.soapclient.php
*
**/
$options = array();
// general option
@loru88
loru88 / Git Snippets
Last active January 31, 2019 14:56
Command line snippets for common Git tasks
a series of handy git command I use often
@loru88
loru88 / varnish.sh
Last active July 3, 2017 08:56
Varnish
#log varnish request by host
$ varnishlog -c -m RxHeader:"Host: host.it"
# cancellare cache per un host
$ ssh {varnish IP} # indirizzo del server varnish
$ varnishadm
$ ban req.http.host == "leads.omniauto.it"
$ quit
@loru88
loru88 / bash.sh
Last active June 3, 2019 04:35
Terminal Utils
#!/usr/bin/env bash
## list content folder with size in human readable format
$ ls -lh
## file size in human readable format
$ du -h filename
## folder size in human readable format
$ du -msh folderName
@loru88
loru88 / GitHub curl.sh
Created May 21, 2017 22:16 — forked from Integralist/GitHub curl.sh
Download a single file from a private GitHub repo. You'll need an access token as described in this GitHub Help article: https://help.github.com/articles/creating-an-access-token-for-command-line-use
curl --header 'Authorization: token INSERTACCESSTOKENHERE' \
--header 'Accept: application/vnd.github.v3.raw' \
--remote-name \
--location https://api.github.com/repos/owner/repo/contents/path
# Example...
TOKEN="INSERTACCESSTOKENHERE"
OWNER="BBC-News"
REPO="responsive-news"
<?php
/*
* Resize images dynamically using wp built in functions
* Victor Teixeira
*
* php 5.2+
*
* Exemplo de uso:
*
* <?php