Skip to content

Instantly share code, notes, and snippets.

@brunoleles
brunoleles / deb: command not found.md
Last active February 23, 2022 14:27
Add repository on Debian when "deb" command is not available

deb: command not found

This gist seems to be not working anymore

Possible alternative solution https://unix.stackexchange.com/a/508728 ( not tested )

The Problem

$> deb http://ftp.debian.org/debian jessie-backports main
@brunoleles
brunoleles / readme.md
Last active January 22, 2021 15:10
Gulp Watch Fails with "Error: watch ... ENOSPC"

gulp watch fails with error: Error: watch ... ENOSPC

Stacktrace:

[13:58:28] Starting 'watch'...
[13:58:28] 'watch' errored after 22 ms
[13:58:28] Error: watch /.../resources/assets/images/ ENOSPC
    at exports._errnoException (util.js:1023:11)
    at FSWatcher.start (fs.js:1306:19)
 at Object.fs.watch (fs.js:1331:11)
@brunoleles
brunoleles / MySQL general log on table.md
Last active October 23, 2017 18:59
MySQL general log on table

Save MySQL general log on table instead of a log file.

Turn on general log to table

SET GLOBAL general_log = 'OFF';
ALTER TABLE `mysql`.`general_log` ENGINE = MyISAM;
ALTER TABLE `mysql`.`slow_log` ENGINE = MyISAM;
SET GLOBAL general_log = 'ON';
@brunoleles
brunoleles / Gulp Watch ENOSPC.md
Last active October 30, 2017 20:43 — forked from devhero/node_watch_ENOSPC.js
Error: watch ENOSPC

Gulp Watch Error "ENOSPC"

Execute:

echo fs.inotify.max_user_watches=524288 | sudo tee -a /etc/sysctl.conf && sudo sysctl -p

You should see something like:

@brunoleles
brunoleles / Install mongo-org on Ubuntu 16.04.md
Last active February 16, 2018 14:32
Install mongo-org on Ubuntu 16.04

Install mongo-org 3.6 on Ubuntu 16.04

# https://docs.mongodb.com/manual/tutorial/install-mongodb-on-ubuntu/
sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv 2930ADAE8CAF5059EE73BB4B58712A2291FA4AD5

echo "deb [ arch=amd64,arm64 ] https://repo.mongodb.org/apt/ubuntu xenial/mongodb-org/3.6 multiverse" | sudo tee /etc/apt/sources.list.d/mongodb-org-3.6.list

sudo apt-get update -y
@brunoleles
brunoleles / Fix "Cannot set LC_ALL to default locale no Ubuntu".md
Last active February 16, 2018 14:31
Fix "Cannot set LC_ALL to default locale no Ubuntu"

Run locale-gen en_US en_US.UTF-8 pt_BR.UTF-8 or dpkg-reconfigure locales

Note: pt_BR.UTF-8 must be changed to your locale.

@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 >

@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 / 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"