Skip to content

Instantly share code, notes, and snippets.

@janus57
janus57 / install_php_sury.sh
Last active March 14, 2026 06:04
Install "deb.sury.org" repository for PHP
#!/bin/bash
# For up-to-date version see : https://packages.sury.org/php/README.txt
wget https://packages.sury.org/php/apt.gpg -O /usr/share/keyrings/deb.sury.org-php.gpg
echo "deb [signed-by=/usr/share/keyrings/deb.sury.org-php.gpg] https://packages.sury.org/php/ $(lsb_release -sc) main" > /etc/apt/sources.list.d/php-sury.list
apt update
@janus57
janus57 / comptage.php
Created May 29, 2017 10:33
count jpg/jpeg file un directory and subdirectory with php/system/find
<?php
$comptage = system("find . -type f -exec file {} \; | grep -i 'jpeg\|jpg' | wc -l");
file_put_contents('comptage.txt', $comptage);
?>
@janus57
janus57 / pi-hole-setup-methode-with-bind9.md
Created November 26, 2016 18:34
Pi-Hole with bind9 as forwarder

Installation of bind9

apt install bind9

Create a virtual interface (eth0:1)

Note: i have the IP : 192.168.1.109 by DHCP

edit the network settings file

@janus57
janus57 / OPcache_config.ini
Last active November 6, 2016 14:06
notes/memos about usefull commands
# Enable OPcache
opcache.enable=1
# The Memoru used by OPcache, default 64MB
# 128MB can ba good for 5 to 10 websites
opcache.memory_consumption=64
# 4MB seem to be prety "low", 8MB or 16MB seem better for website with lot of same class/variables
# Quick "explanation" : if you have the string "foobar" 1000 times in your code,
# internally OPcache will store 1 immutable variable for this string and just use a pointer
@janus57
janus57 / index.html
Last active August 29, 2015 14:25 — forked from d3noob/index.html
Add multiple markers in leaflet.js
<!DOCTYPE html>
<html>
<head>
<title>Simple Leaflet Map</title>
<meta charset="utf-8" />
<link
rel="stylesheet"
href="http://cdn.leafletjs.com/leaflet-0.7/leaflet.css"
/>
</head>
@janus57
janus57 / .htaccess
Last active August 29, 2015 14:24
block specific domain against hotlinking
# Methode 1
# block specific domains
<IfModule mod_rewrite.c>
RewriteEngine On
# match example.org/com etc...
RewriteCond %{HTTP_REFERER} ^http://([^.]+\.)?example\. [NC]
# rewrite to specific file
RewriteRule \.(gif|jpg|bmp|jpeg|png)$ http://example.org/bad.jpg [R,NC,L]
</IfModule>
@janus57
janus57 / example.php
Created May 31, 2015 01:34
PHP intl "fr_FR" pattern for NumberFormatter for old intl ICU Data
<?php
$pattern = file_get_contents('fr_FR.txt');
$fmt = new NumberFormatter('fr_FR', NumberFormatter::PATTERN_RULEBASED, $pattern);
echo $fmt->format(52450.00);
?>
@janus57
janus57 / all-find-potential-malware-occurences.sh
Last active August 29, 2015 14:18 — forked from anotheremily/find-base64-occurences
hackers seem to like base64 (or eval) encoding their php commands
#!/bin/bash
# This will find ANY "base64" or "eval(" or "eval)" which are potentially a malware and write all output in detections.txt
# WARNING : This bash script need to be executed in the "infected" folder, like /var/www/
find . -type f -exec grep -Hn "base64\|eval(\|eval)" '{}' \; &> detections.txt
@janus57
janus57 / .htaccess
Last active August 29, 2015 14:17
Simple .htaccess for maintenance page
ErrorDocument 503 /maintenance.php
RewriteEngine On
#RewriteCond %{REMOTE_ADDR} !^111\.222\.333\.444$ #to ignore IP
RewriteCond %{REQUEST_URI} !\.(png|jpg)$ #you can add other extension like JS or whatever (to exclude the 503)
RewriteCond %{REQUEST_URI} !/maintenance.php$ #excluding the maintenance page itself
RewriteRule .* - [R=503,L]