Skip to content

Instantly share code, notes, and snippets.

View mrtoorich's full-sized avatar

Mr. TooRich mrtoorich

View GitHub Profile
@oasisfeng
oasisfeng / verify_google_ips.sh
Created April 28, 2023 16:29
Shell script to verify connectable Google IPs
#!/bin/bash
if [ $# -ne 1 ]; then
echo "Usage: $0 <IP>[/subnet]"
exit 1
fi
for ip in $(nmap -sL $1 | awk '/Nmap scan report/{print $NF}'); do {
ip=$(echo $ip | tr -d '()')
output=$(curl --connect-to :443:$ip:443 --connect-timeout 5 --verbose --head https://www.google.com.hk 2>&1)
@karlhorky
karlhorky / clear-npx-cache.sh
Last active February 7, 2024 05:16
Clear npx cache
# First, remove all the folders in the npx cache location
# https://github.com/npm/cli/issues/1935#issuecomment-745561262
rm -rf $(npm get cache)/_npx/*
@igorjs
igorjs / rest-api-response-format.md
Last active May 6, 2024 01:55
REST API response format based on some of the best practices
@brunogaspar
brunogaspar / macro.md
Last active May 1, 2024 07:24
Recursive Laravel Collection Macros

What?

If a nested array is passed into a Laravel Collection, by default these will be threaded as normal arrays.

However, that's not always the ideal case and it would be nice if we could have nested collections in a cleaner way.

This is where this macro comes in handy.

Setup

@faressoft
faressoft / dom_performance_reflow_repaint.md
Last active May 6, 2024 06:11
DOM Performance (Reflow & Repaint) (Summary)

DOM Performance

Rendering

  • How the browser renders the document
    • Receives the data (bytes) from the server.
    • Parses and converts into tokens (<, TagName, Attribute, AttributeValue, >).
    • Turns tokens into nodes.
    • Turns nodes into the DOM tree.
  • Builds CSSOM tree from the css rules.
@luckydev
luckydev / gist:b2a6ebe793aeacf50ff15331fb3b519d
Last active October 22, 2022 14:03
Increate max no of open files limit in Ubuntu 16.04/18.04 for Nginx
# maximum capability of system
user@ubuntu:~$ cat /proc/sys/fs/file-max
708444
# available limit
user@ubuntu:~$ ulimit -n
1024
# To increase the available limit to say 200000
user@ubuntu:~$ sudo vim /etc/sysctl.conf
@muhammadghazali
muhammadghazali / What is server_names_hash_bucket_size.md
Last active February 9, 2024 14:13
Nginx: What is server_names_hash_bucket_size?

Background

While I'm learning how to use Nginx, I was instructed to update the server_names_hash_bucket_size (/etc/nginx/nginx.conf) value from 32 to 64, but I don't understand why should I increase the value to 64.

References

References that have been read so far:

@Explorare
Explorare / com.google.Chrome.mobileconfig
Last active November 28, 2022 05:54
Add local chrome extensions to whitelist in MacOS. https://hencolle.com/2016/10/16/baidu_exporter/
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>PayloadContent</key>
<array>
<dict>
<key>PayloadContent</key>
<dict>
<key>com.google.Chrome</key>
@pandafulmanda
pandafulmanda / Python3 Virtualenv Setup.md
Last active March 12, 2024 15:59 — forked from akszydelko/Python3 Virtualenv Setup.md
Setting up and using Python3 Virtualenv on Mac

Python3 Virtualenv Setup

Requirements
  • Python 3
  • Pip 3
$ brew install python3
@dtomasi
dtomasi / default
Last active December 8, 2023 04:20
Brew Nginx PHP7
server {
listen 80;
server_name localhost;
root /Users/YOUR_USERNAME/Sites;
access_log /Library/Logs/default.access.log main;
location / {
include /usr/local/etc/nginx/conf.d/php-fpm;
}