Skip to content

Instantly share code, notes, and snippets.

@brunoleles
brunoleles / readme.md
Created June 11, 2024 13:19
Mongodb Logrotate config example

Mongodb Logrotate config example

Mongodb don't rotate automaticaly its logs, this config to lofrotate does the trick

# File: /etc/logrotate.d/mongodb
/var/log/mongodb/mongod.log {
        daily
        missingok
 rotate 14
@brunoleles
brunoleles / Android (allow screen capture cast).md
Last active June 26, 2024 20:16
Android (allow screen capture cast)
@brunoleles
brunoleles / readme.md
Created April 18, 2023 14:18
Ubuntu - SSH Keep Alive
  • Open: /etc/ssh/sshd_config
  • Change:
    • TCPKeepAlive yes
    • ClientAliveInterval 100 (desired interval in seconds )
  • Restart ssh service (mine was, sudo service ssh restart )
  • To validade, open a ssh coneection and on other terminal, run sudo tcpdump -n -tttt
@brunoleles
brunoleles / README.md
Last active March 24, 2022 23:22
Modify Apache2 Server Header (Ubuntu)

Modify Apache 2 Server Header

Check if mod_security2

$> ls -lah /etc/apache2/mods-available/ | egrep "security"
-rw-r--r-- 1 root root  551 Mar 24 22:43 security2.conf
-rw-r--r-- 1 root root   91 Sep 28  2017 security2.load
@brunoleles
brunoleles / README.md
Last active December 13, 2021 02:41
git - reset only file permissions, keep content modifications
@brunoleles
brunoleles / README.md
Last active May 9, 2021 04:04
Workaround: Uncaught Error: Call to undefined function xdebug_is_enabled()

workaround - function "xdebug_is_enabled" has been deprecated

<?php
if (!function_exists('xdebug_is_enabled')) {
	function xdebug_is_enabled() {
		if (ini_get('xdebug.mode') === 'develop') {
			return true;
		}
 return false;
@brunoleles
brunoleles / README.md
Last active January 22, 2021 15:06
Install PHP 7.1 - Ubuntu

Install PHP 7.1 - Ubuntu

Assumptions

  • Apache2 is already installed

Steps

Adding packages repositories and dependencies

@brunoleles
brunoleles / squid-deb-proxy_on_docker.md
Created September 16, 2020 05:28 — forked from dergachev/squid-deb-proxy_on_docker.md
Caching debian package installation with docker

TLDR: I now add the following snippet to all my Dockerfiles:

# If host is running squid-deb-proxy on port 8000, populate /etc/apt/apt.conf.d/30proxy
# By default, squid-deb-proxy 403s unknown sources, so apt shouldn't proxy ppa.launchpad.net
RUN route -n | awk '/^0.0.0.0/ {print $2}' > /tmp/host_ip.txt
RUN echo "HEAD /" | nc `cat /tmp/host_ip.txt` 8000 | grep squid-deb-proxy \
  && (echo "Acquire::http::Proxy \"http://$(cat /tmp/host_ip.txt):8000\";" > /etc/apt/apt.conf.d/30proxy) \
  && (echo "Acquire::http::Proxy::ppa.launchpad.net DIRECT;" >> /etc/apt/apt.conf.d/30proxy) \
  || echo "No squid-deb-proxy detected on docker host"
@brunoleles
brunoleles / ocp.php
Created June 17, 2020 01:28 — forked from ck-on/ocp.php
OCP - Opcache Control Panel (aka Zend Optimizer+ Control Panel for PHP)#ocp #php #opcache #opcode #cache #zend #optimizerplus #optimizer+
<?php
/*
OCP - Opcache Control Panel (aka Zend Optimizer+ Control Panel for PHP)
Author: _ck_ (with contributions by GK, stasilok)
Version: 0.1.7
Free for any kind of use or modification, I am not responsible for anything, please share your improvements
* revision history
0.1.7 2015-09-01 regex fix for PHP7 phpinfo
0.1.6 2013-04-12 moved meta to footer so graphs can be higher and reduce clutter
@brunoleles
brunoleles / readme.md
Last active June 17, 2020 00:33
Update all expired keys from Ubuntu key server
sudo apt-key list | \
 grep "expired: " | \
 sed -ne 's|pub .*/\([^ ]*\) .*|\1|gp' | \
 xargs -n1 sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys

Sources:

https://stackoverflow.com/a/46737148 >