Skip to content

Instantly share code, notes, and snippets.

@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 / 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 / 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 / readme.md
Last active August 2, 2018 09:27
htaccess for default wordpress installations
convert -density 300 test.svg -colorspace CMYK -profile colorProfiles/ISOcoated_v2_eci.icc out8.pdf
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Are you online?</title>
<style>
body {
color: #fff;
font-family: sans-serif;
$$('.collectionChildren .collectionItem').forEach(function(e) {console.log(e.getAttribute('id').replace("sharedfile_", "ServerSubscribedWorkshopItems=")) })
function getGIF(tag, id) {
document.title = tag.replace('yes', 'ja').replace('no', 'nein').toUpperCase(); // set doc title
superagent // call giphy api
.get('http://api.giphy.com/v1/gifs/random?api_key=dc6zaTOxFJmzC&tag=' + tag)
.set('Accept', 'application/json')
.end(function(err, res) {
if (err || !res.ok) {
console.error('API call failed.');
console.log(err);
@CodeBrauer
CodeBrauer / rustServerScript.sh
Created January 8, 2016 00:18 — forked from Rhagnur/rustServerScript.sh
Angepasstes Skript um Rust Server auf Linux zum laufen zu bekommen
#!/bin/bash
#command to manually start if you want to close this script (do it in screen)
#xvfb-run --auto-servernum --server-args='-screen 0 640x480x24:32' wine RustDedicated.exe -batchmode +rcon.ip 0.0.0.0 +rcon.port "48000" +rcon.password killer +server.hostname "-LINUX RUST-US-Pro Admins-NO WIPE-NEWBS WELCOM-" +server.port "28015" +server.identity "nfo_rust_server1" +server.maxplayers "2000"
#####################################################################################
# Linux script for Rust server installing. #
# Can also be used to update Rust server and steamcmd. #
# Starts a rust server at the end. #
# #
# If you use a sudoers file please execute this command first to get root access: #
# sudo -s #
@CodeBrauer
CodeBrauer / show_absolute_timestamps_commits_log_gitlab.js
Last active January 24, 2016 14:56
show absolute timestamps commits log gitlab
setInterval(function() {
timestamps = document.querySelectorAll('time');
Array.prototype.forEach.call(timestamps, function(el) {
el.innerHTML = el.getAttribute('datetime')
});
}, 1);