Skip to content

Instantly share code, notes, and snippets.

View Ostico's full-sized avatar

Domenico Lupinetti Ostico

View GitHub Profile
@Ostico
Ostico / access_containers_on_macvlan_from_host.md
Last active March 4, 2024 10:20
Give your host access to Docker containers with macvlan

Give your host access to Docker containers with macvlan

Let's assume you have a macvlan interface running.

#$ docker network inspect test_loc-macvlan

[
@Ostico
Ostico / gist:fdab8368356e07900c995b0b4518ca54
Created August 22, 2023 14:52
Apache2.4 per Process memory consumption
#!/bin/bash
ps -ylC apache2 --sort:rss | awk '{sum+=$8; ++n} END {print "Tot="sum"("n")";print "Avg="sum"/"n"="sum/n/1024"MB"}'
@Ostico
Ostico / instance-name-tag.sh
Created August 18, 2023 15:16 — forked from swithrow/instance-name-tag.sh
EC2 Instance Name Tag in the bash prompt.
#!/bin/bash
#
# copy this into /etc/profile.d/instance-name-tag.sh
#
# you will need:
# - curl, jq, and aws cli installed
# - an IAM role that gives the EC2 instance access to describe tags
#
@Ostico
Ostico / README.md
Last active September 14, 2023 16:29 — forked from zoilomora/README.md
How to use a custom `resolv.conf` file with systemd-resolved in Ubuntu

How to use a custom resolv.conf file with systemd-resolved in Ubuntu

Stages

  • Disable and stop the systemd-resolved service:

    sudo systemctl stop systemd-resolved
    
  • Then put the following line in the [main] section of your /etc/NetworkManager/NetworkManager.conf:

# maximum capability of system
user@ubuntu:~$ cat /proc/sys/fs/file-max
708444
# If this limit is too low, you can increase the available limit to say 200000
user@ubuntu:~$ sudo vim /etc/sysctl.conf
# add the following line to it
fs.file-max = 200000

Keybase proof

I hereby claim:

  • I am ostico on github.
  • I am ostico (https://keybase.io/ostico) on keybase.
  • I have a public key ASBfbyMT0Msc0514ycsCd1gMb-kfWTDNyP-_MeB8nJ75ygo

To claim this, I am signing this object:

<?php
/**
* Get the char code from a multi byte char
*
* 2/3 times faster than the old implementation
*
* @param $mb_char string Unicode Multibyte Char String
*
* @return int
@Ostico
Ostico / ObjectTest.php
Last active April 11, 2016 18:59
ObjectComparator does not check for Object Hash but internally knows that objects are different.
<?php
/**
* @author Domenico Lupinetti ostico@gmail.com
* Date: 11/04/16
* Time: 19.52
*
* The try block is executed but the comparison are made on Exporter::toArray()
* and if the object has no properties $expected and $actual are equals but refers to two different instances
* ( tried with PDO as example )
*