Skip to content

Instantly share code, notes, and snippets.

View antistereotip's full-sized avatar

Milutin Gavrilović antistereotip

View GitHub Profile
@antistereotip
antistereotip / sitemap.xml.php
Created August 13, 2021 16:40 — forked from artlung/sitemap.xml.php
Generate XML sitemap from list of urls
<?php
/**
*
* This is a quick way to turn a simple text file
* with a list of urls in a text file (sitemap-urls.txt)
* into a valid XML Sitemap:
* http://en.wikipedia.org/wiki/Sitemaps
* Put this file sitemap.xml.php and sitemap-urls.txt at
* the webroot http://example.com/sitemap.xml.php
@antistereotip
antistereotip / led.py
Created March 26, 2021 18:40
control led
from gpiozero import LED
import time
import keyboard
K = input("Sleep for: ")
zeleno = LED(18)
zuto = LED(17)
crveno = LED(23)
crveno_indikator = LED(21)
@antistereotip
antistereotip / php.ini
Created September 21, 2020 19:24
php.ini modification for safemode
safemode=on
# Add Security Headers
<IfModule mod_headers.c>
# Protect against XSS attacks
Header set X-XSS-Protection "1; mode=block"
</IfModule>
<IfModule mod_rewrite.c>
RewriteCond %{QUERY_STRING} (\<|%3C).*script.*(\>|%3E) [NC,OR]
RewriteCond %{QUERY_STRING} GLOBALS(=|\[|\%[0-9A-Z]{0,2}) [OR]
RewriteCond %{QUERY_STRING} _REQUEST(=|\[|\%[0-9A-Z]{0,2})
<?php
#--------kompresuj_stranicu---------#
function KompresujStranu($Baferuj) {
$Pretrazi = array(
'/\>[^\S ]+/s', // ocisti razmake izmedju tagova, izuzev spejsa
'/[^\S ]+\</s', // ocisti razmake pre tagova, izuzev spejsa
'/(\s)+/s' // skrati vise spojenih spejsova
);
$Zameni = array(
'>',
<?php
/* counter */
//opens countlog.txt to read the number of hits
$datei = fopen("./countlog.txt","r");
$count = fgets($datei,1000);
fclose($datei);
$count=$count + 1 ;
echo "<p>$count" ;
<?php
//skupi stranice u niz, kompresuj, keshiraj i baferuj :)
$css = array("master.css", "acc.css", "anm.css", "qrs.css");
$bffr = "";
foreach ($css as $cs) {
$bffr .= file_get_contents($cs);
}
$bffr = preg_replace('!/\*[^*]*\*+([^/][^*]*\*+)*/!', '', $bffr);
$bffr = str_replace(': ', ':', $bffr);
$bffr = str_replace(array("\r\n", "\r", "\n", "\t", ' ', ' ', ' '), '', $bffr);
<?php
function rostilj_calculator($broj_osoba = 1 , $difficulty_level = 1){
//po osobi
$materijal = array(
'meso'=> array(
'po osobi'=>true,
'kolicine'=> array(
'cevapi' => 3.2,
'vrat' => 1.2,
@antistereotip
antistereotip / curl-crawl-urls.php
Last active October 28, 2015 05:54
WOW :) SIMPLE STUPID CURL CRAWLER - NG1NP PRODUCT NO7 BASED ON SIMPLICITY.
<?php
$cinit = curl_init(); curl_setopt($cinit, CURLOPT_URL,"http://antistereotip.net/");
#-- timeout posle 30 sekundi --#
curl_setopt($cinit, CURLOPT_TIMEOUT, 30); curl_setopt($cinit, CURLOPT_RETURNTRANSFER,1);
$result=curl_exec ($cinit); curl_close ($cinit);
#-- Pretrazuje rezultate iz url-a --#
if($result) {
#-- TODO: Regularni izrazi, ali odraditi ovo samo za top domene :) --#
$regex = "/\b(?:(?:https?|ftp):\/\/|www\.)[-a-z0-9+&@#\/%?=~_|!:,.;]*[-a-z0-9+&@#\/%=~_|]/i";
$regex2 = '/\b(?:(?:https?|ftp|file):\/\/|www\.|ftp\.)[-A-Z0-9+&@#\/%=~_|$?!:,.]*[A-Z0-9+&@#\/%=~_|$]/i';
@antistereotip
antistereotip / simple-dom-crawl.php
Created October 28, 2015 05:07
SIMPLE STUPID :)
<?php
include_once('simple_html_dom.php');
$target_url = 'http://example.net';
$html = new simple_html_dom();
$html->load_file($target_url);
foreach($html->find('a') as $link)
{
echo $link->href."<br />";
}