Skip to content

Instantly share code, notes, and snippets.

View NikolaiT's full-sized avatar
🏠
Working from home

Nikolai Tschacher NikolaiT

🏠
Working from home
View GitHub Profile
@NikolaiT
NikolaiT / patch to emg
Created December 20, 2013 11:30
A patch to the easy-media-gallery security issue.
function spg_add_admin() {
global $emgplugname, $theshort, $theopt;
// Checks that the wp_http_referer includes emg_settigns. This means that the request originated from the emg settings form. But this
// may cause problems if other plugins user the same parameters, which is nontheless very unlikely.
if (strpos($_REQUEST['_wp_http_referer'], 'post_type=easymediagallery&page=emg_settings') !== FALSE && isset($_REQUEST['_wpnonce']) && check_admin_referer('easy_options_group-options')) {
if (is_admin() && ( isset($_GET['page']) == 'emg_settings' ) && ( isset($_GET['post_type']) == 'easymediagallery' )) {
if (isset($_REQUEST['action']) && 'save' == $_REQUEST['action']) {
$curtosv = get_option('easy_media_opt');
foreach ($theopt as $theval) {
$curtosv[$theval['id']] = $_REQUEST[$theval['id']];
@NikolaiT
NikolaiT / xss poc
Created December 20, 2013 21:15
xss POC
<!DOCTYPE html>
<html>
<head>
<title>XSS POC</title>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width">
</head>
<body>
<div>
@NikolaiT
NikolaiT / blabla
Created May 12, 2014 21:02
some java
import java.util.UUID;
import java.util.Random;
/*
* Run and compile:
*
* javac Timer.java && java -Djava.compiler=NONE Timer
*
* Aufgabe 1.
*
@NikolaiT
NikolaiT / AD Loesung
Created December 16, 2014 17:37
Finds the path with best probability in router network
#!/usr/bin/python2
import thread
import threading
import Queue
matrix = [
[0.0, 0.82, 0.59, 0.68, 0.71, 0.31, 0.42, 0.05, 0.0, 0.0, 0.26, 0.0, 0.18, 0.56, 0.42, 0.45],
[0.59, 0.0, 0.72, 0.81, 0.16, 0.29, 0.0, 0.0, 0.0, 0.29, 0.0, 0.0, 0.87, 0.74, 0.08, 0.64],
[0.54, 0.0, 0.0, 0.08, 0.0, 0.43, 0.94, 1.0, 0.29, 0.95, 0.09, 0.71, 0.0, 0.51, 0.0, 0.0],
@NikolaiT
NikolaiT / blatt5_aufgabe3.R
Created November 17, 2015 11:47
R Skript Stochastik Aufgabe 3 - Blatt 5
#!/usr/bin/env Rscript
# Diese Funktion berechnet die exakte und die approximierte Version
calc_exact_and_approx <- function(n, p, x1, x2) {
# exakte Berechnung:
sum <- 0
for(i in x1:x2) {
sum <- sum + ( choose(n, i) * p**i * (1 - p)**(n-i) )
}