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
import java.util.ArrayList; | |
import java.util.HashMap; | |
import java.util.Iterator; | |
import java.util.List; | |
import java.util.Map; | |
import java.util.Scanner; | |
import java.util.regex.Matcher; | |
import java.util.regex.Pattern; | |
import org.apache.log4j.Logger; |
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
Flight::map('stream', function($resource){ | |
Flight::response()->sendHeaders(); | |
while ($buf = fread($resource, 1024)) { | |
echo $buf; | |
ob_flush(); | |
flush(); | |
} | |
exit(0); | |
}); |
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
FROM php:5.4-cli | |
COPY . / | |
ENTRYPOINT ["php"] | |
CMD ["/shutdown-with-goaop.php"] |
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
import net.sf.mpxj.MPXJException; | |
import net.sf.mpxj.ProjectFile; | |
import net.sf.mpxj.Task; | |
import net.sf.mpxj.mpp.MPPReader; | |
import java.io.IOException; | |
import java.nio.file.Files; | |
import java.nio.file.Paths; | |
import java.util.*; | |
import java.util.logging.*; |
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
// \Podio::request | |
$raw_response = preg_replace('/^.*\r\n\r\nHTTP/s', 'HTTP', $raw_response); | |
$header = preg_split('/\r\n\r\n/s', $raw_response, 2)[0]; | |
$raw_headers_size = strlen($header) + 4; |
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
import re | |
import argparse | |
import os | |
import pprint | |
import mimetypes | |
parser = argparse.ArgumentParser(description='Listing transitive references.') | |
parser.add_argument('start', nargs='+', help='Starting file(s).') | |
parser.add_argument('--pattern', default='[\'"]([^\'":[\]]+\.(?:png|jpg|gif|xml|html?|php|js))[\'"]', | |
help='Regex for matching references. \ |
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 | |
# copy to: /etc/cron.hourly/check-wlan | |
# test with: sudo run-parts --test /etc/cron.hourly | |
if ifconfig wlan0 | grep "inet addr:" ; then | |
logger "wifi ok" | |
exit | |
else | |
logger "Network down! Attempting reconnection." |
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
// convert via https://mrcoles.com/bookmarklet/ | |
var tasks = prompt('Tasks mit Kommas abgetrennt eingeben:', 'Test planen,Testdaten definieren,Tests erstellen,Test durchführen & dokumentieren').split(','); | |
var match = window.location.pathname.match(/[A-Z]+-[0-9]+/); | |
if (match[0]) { | |
var task = match[0]; | |
var match = task.match(/[A-Z]+/); | |
var project = match[0]; | |
var promises = []; | |
for (var i = 0; i < tasks.length; i++) { |
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
// This script loops though all collections of all db in a MongoDB and runs the compact operation on them | |
// Simply paste this into the Mongo shell | |
db.getMongo().setReadPref('secondary'); | |
db.getMongo().getDBNames().forEach(function(dbName) { | |
if (["local", "admin", "system", "config"].indexOf(dbName) < 0 /* && dbName > "config"*/) { | |
var subject = db.getSiblingDB(dbName); | |
subject.getCollectionNames() | |
.filter(c => ['system.users', 'system.roles'].indexOf(c) < 0) | |
.forEach(function (collectionName) { |
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
const minCharCode = Math.min(...'aAzZ019-_.:,'.toUpperCase().split('').map(c => c.charCodeAt(0))); | |
const maxCharCode = Math.max(...'aAzZ019-_.:,'.toUpperCase().split('').map(c => c.charCodeAt(0))); | |
const alphabetSize = maxCharCode - minCharCode + 2; | |
console.log(minCharCode, maxCharCode, alphabetSize, Number.MAX_SAFE_INTEGER, Number.MIN_SAFE_INTEGER); | |
function toNumber(char) { | |
return char.toUpperCase().charCodeAt(0) - minCharCode + 1; | |
} |
OlderNewer