Skip to content

Instantly share code, notes, and snippets.

View realtebo's full-sized avatar
💭
I may be slow to respond.

Mirko Tebaldi realtebo

💭
I may be slow to respond.
  • Somewhere over the raimbow
  • Ferrara, Italy
View GitHub Profile
@realtebo
realtebo / hosts
Created August 7, 2018 20:25
/etc/ansible/hosts
[local]
localhost ansible_connection=local
[windows:vars]
ansible_winrm_scheme=http
ansible_connection=winrm
@realtebo
realtebo / First steps with ansible.md
Last active August 8, 2018 16:15
Starting with ansible

For the file group_vars/windows/main.yml I suggest to use ansible vault

@realtebo
realtebo / Dockerfile
Last active August 9, 2018 12:24
Start with docker + laravel
FROM php:7.0.4-fpm
RUN apt-get update && apt-get install -y libmcrypt-dev \
mysql-client libmagickwand-dev --no-install-recommends \
&& pecl install imagick \
&& docker-php-ext-enable imagick \
&& docker-php-ext-install mcrypt pdo_mysql
@realtebo
realtebo / readme.md
Last active August 11, 2018 20:35
Add a new PiHole
  1. Clone Ubuntu base VM

  2. Assign IP to the new machine (read MAC at assign using DHCP)

  3. Add the ip to ansible [dns] group, in the file /etc/ansible/hosts

  4. Login with default username and password

  5. Enble SSH auth via password to allow first ansible login

       sudo sed -i 's/PasswordAuthentication no/PasswordAuthentication yes' /etc/ssh/sshf_config
    
  6. Restart

  7. From ansible controller, check

@realtebo
realtebo / service-worker.js
Created November 15, 2018 08:04 — forked from cristoni/service-worker.js
Esempio di service worker con workbox per workbox-webpack-plugin
if (workbox) {
console.log(`Yay! Workbox is loaded 🎉`);
// workbox.setConfig({ debug: false });
// workbox.precaching.suppressWarnings();
workbox.precaching.precacheAndRoute(self.__precacheManifest, {});
workbox.routing.registerRoute(/^https?.*/, workbox.strategies.networkFirst(), 'GET');
} else {
console.log(`Boo! Workbox didn't load 😬`);
}
@realtebo
realtebo / service-worker.js
Created November 16, 2018 20:06
Portion of service-worker.js
server.get("/service-worker.js", (req, res) => {
// Don't cache service worker is a best practice (otherwise clients wont get emergency bug fix)
res.set("Cache-Control", "no-store, no-cache, must-revalidate, proxy-revalidate");
res.set("Content-Type", "application/javascript");
const filePath = join(__dirname, '.next', req.url);
app.serveStatic(req, res, filePath);
});
@realtebo
realtebo / Instructions
Last active April 1, 2019 16:25
Backup of mysql on gdrive on a debian
#!/bin/bash
# Installation
su
apt-get install software-properties-common dirmngr
apt-add-repository 'deb http://shaggytwodope.github.io/repo ./'
apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 7086E9CC7EC3233B
apt-get update
apt-get install drive
@realtebo
realtebo / init
Created April 2, 2019 10:00
Inizializzare un processore Nativescript vue correttamente
tns create Countdown --vue
cd Countdown
node_modules\.bin\update-ns-webpack --configs
tns doctor
@realtebo
realtebo / configurazione di esempio nginx
Last active May 2, 2019 07:58
Step per avviare un progetto laravel + vue
server {
listen 80;
listen 443 ssl http2;
server_name blablabla.local www.blablabla.local;
root /var/www/html/blablabla.com/public;
add_header X-Frame-Options "SAMEORIGIN";
@realtebo
realtebo / search.sh
Last active June 21, 2019 12:53
Search corrupted php file and fake icons
#!/bin/bash
EXIT_CODE=0
for cartella in $( ls -l /var/www | grep -e "^d" | awk '{ print $9 }'); do
echo "Scansione /var/www/$cartella ...."
for phpfile in $(find /var/www/$cartella -type f -iname '*.php'); do