Skip to content

Instantly share code, notes, and snippets.

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Are you online?</title>
<style>
body {
color: #fff;
font-family: sans-serif;
convert -density 300 test.svg -colorspace CMYK -profile colorProfiles/ISOcoated_v2_eci.icc out8.pdf
@CodeBrauer
CodeBrauer / readme.md
Last active August 2, 2018 09:27
htaccess for default wordpress installations
@CodeBrauer
CodeBrauer / kf2.webadmin.user.js
Created April 28, 2016 16:58
kf2.webadmin.user.js - better players info
function callAjax(url, callback) {
var xmlhttp;
xmlhttp = new XMLHttpRequest();
xmlhttp.onreadystatechange = function () {
if (xmlhttp.readyState == 4 && xmlhttp.status == 200) {
callback(JSON.parse(xmlhttp.responseText));
}
}
xmlhttp.open('GET', url, true);
xmlhttp.send();
@CodeBrauer
CodeBrauer / read_instead_execute_me.sh
Created May 30, 2016 15:30
Delete duplicate files (by filesize)
bye;
# from: http://superuser.com/questions/1081539/delete-files-with-same-size-but-keep-always-one-file
# find the files to keep
find . -type f -printf "%s %p\n" | grep "zip" | sort -n | uniq -d --check-chars=10 > files.txt
# here it goes!
mkdir unique
@CodeBrauer
CodeBrauer / openpdf.php
Last active June 2, 2016 14:17
Open PDF instead downloading it with php
<?php
/* instead using this headers
header('Content-type: application/octet-stream');
header('Content-Disposition: attachment; filename="'.$filename.'"');
// use this headers */
header("Content-type: application/pdf");
header("Content-Length: ".$length);
header("Content-Disposition: inline; filename=\"".$filename."\"");
@CodeBrauer
CodeBrauer / blur.php
Last active June 16, 2016 08:54
Blur image dynamically
<?php
/**
* Strong Blur
*
* @param resource $gdImageResource
* @param int $blurFactor optional
* This is the strength of the blur
* 0 = no blur, 3 = default, anything over 5 is extremely blurred
* @return GD image resource
@CodeBrauer
CodeBrauer / load.php
Last active February 8, 2017 11:43
get server % load (debian) in php
<?php
$load = str_replace(',','.', trim(`uptime| awk '{print $10 }'`));
$cores = trim(`lscpu | grep "CPU(s):" | awk '{print $2}' | head -1`);
$percent = $load/$cores * 100;
echo $percent . '%';
@CodeBrauer
CodeBrauer / index.html
Created November 9, 2016 11:19 — forked from anonymous/index.html
Style visited links with localStorage
<div class="wrap">
<h1>Style visited links with localStorage</h1>
<h2>Why?</h2>
<p>
Since browsers allow only very basic CSS on <code>:visited</code> I created this way to check a user has clicked a link. If he clicks on any link, that has the class <code>.trackVisit</code> the complete href is saved in an array in localStorage.
On each page visit and click on a link the script adds the class <code>.visited</code> so we can style it however we want.
</p>
<h2>Demo Links: Repo services</h2>
<p>
The links have <code>e.preventDefault();</code> - so you can click them hassle free ;)
<?php
$urls = [
'http://www.flickr.com/services/feeds/photos_public.gne',
'https://i.stack.imgur.com/fgwQf.jpg',
'https://api.wordpress.org/secret-key/1.1/salt/',
'http://gabrielw.de',
'https://google.com',
'https://raw.githubusercontent.com/CodeBrauer/gmod-loadingscreen/master/img/bg.jpg',
];