Skip to content

Instantly share code, notes, and snippets.

@pierophp
pierophp / index.ts
Last active July 21, 2022 18:05
Cloudflare Worker - Early Hints
import * as cheerio from 'cheerio';
// Dynamic - 5 minutes
const serverMaxAgeDynamic = 60 * 5;
// Dynamic - 1 second (do not cache on browser)
const browserMaxAgeDynamic = 0;
export default {
async fetch(request: Request, env: any, ctx: ExecutionContext) {
@pierophp
pierophp / extract_diff_2_files.sh
Created April 18, 2018 11:34
Extract diff from 2 files
# to apply trim, add: sed 's/^ *//;s/ *$//'
comm -23 <(sort file1) <(sort file2) > file_with_diff
[11:14:07] $ cat a.txt 
a
b

[matheusmmo@bbrandsti-07:~]
[11:14:47] $ cat b.txt 
b
c
# System
sudo launchctl list
sudo launchctl disable system/SERVICE_NAME
# User
id -u MY_USER
launchctl list
sudo launchctl disable user/MY_USER_ID/SERVICE_NAME
docker system prune -a
sudo ifconfig lo:0 128.0.0.1 up
sudo ifconfig lo:0 128.0.0.1 up
@pierophp
pierophp / nodemon.sh
Created November 16, 2017 15:00
Nodemon Increse watches
echo fs.inotify.max_user_watches=524288 | sudo tee -a /etc/sysctl.conf && sudo sysctl -p
@pierophp
pierophp / gist:44bccfadecc0472839b5c61ec7e2c35e
Created August 15, 2017 20:28
Start Elastic Search Manually
sudo -u elasticsearch /usr/share/elasticsearch/bin/elasticsearch -d -p /var/run/elasticsearch/elasticsearch.pid -Epath.conf=/etc/elasticsearch/ -Epath.logs=/var/log/elasticsearch -Epath.data=/var/lib/elasticsearch
@pierophp
pierophp / README.md
Last active May 11, 2017 14:33
Configure Debian To Ansible

Run

apt-get install ca-certificates sudo python exim4-base cron-apt snoopy

groupadd admin

usermod -a -G sudo MY_USER

Edit /etc/sudoers

%sudo ALL=(ALL:ALL) NOPASSWD:ALL