View test-memory-limit.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
<pre> | |
<?php | |
$megabyte = 1528; // define the max megabytes which should be tested | |
function tryAlloc($megabyte){ | |
echo "try allocating {$megabyte} megabyte..."; | |
$mb = $megabyte; | |
$dummy = str_repeat("-",1048576*$mb); | |
echo "pass."; | |
echo "Usage: " . memory_get_usage(true)/1048576; |
View stopwatch.sh
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
# simple stopwatch function | |
# scripted by github.com/thonixx | |
function stopwatch () { | |
######## | |
# config | |
# initialise seconds and start with second 1 | |
sec=1 | |
# define maximum of dots to display | |
maxdots=10 |
View resize-vm-disk-online.sh
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
## | |
## Prerequisites: | |
## - already resized disk on the VM host | |
## | |
## Notes: | |
## - I assume that we have three partitions (primary (root fs), extended, logical (swap)) | |
## - I assume that we move swap out of the extended partition and convert to a normal primary one | |
## - I also assume that we place swap at the end of the disk | |
## |
View aaaa oneliner collection.sh
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
# open gist for oneliner (or very short bash things) collection |
View wait4server.sh
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 | |
# global ssh arguments | |
SSHARG="-o StrictHostKeyChecking=false -o UserKnownHostsFile=/dev/null" | |
TIMEOUT="$(uname | grep -q Darwin && echo gtimeout || echo timeout)" | |
# get IP address from hostname | |
getIP() { | |
# return with failure if no server given | |
test -z "$1" && return 1 |
View check-website.sh
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 | |
red="$(tput setaf 1)" | |
green="$(tput setaf 2)" | |
yellow="$(tput setaf 3)" | |
blue="$(tput setaf 4)" | |
bold="$(tput bold)" | |
reset="$(tput sgr0)" |
View language-handling.conf
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
RewriteEngine on | |
# Language detection (Fallback is en) | |
RewriteCond %{HTTP:Accept-Language} ^de [NC] | |
RewriteCond %{ENV:lang} ^$ | |
RewriteRule ^ - [E=lang:de] | |
RewriteCond %{HTTP:Accept-Language} ^fr [NC] | |
RewriteCond %{ENV:lang} ^$ | |
RewriteRule ^ - [E=lang:fr] |
View force-ruby-to-make-it-an-array.erb
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
<% | |
# define things | |
orig="item0" | |
orig='["item1", "item2"]' | |
orig=["item3", "item4"] | |
# force ruby to make it an array | |
if ! orig.respond_to?('each') | |
var=orig.gsub(/(^\[|\]$)/, "").gsub(/\"/, "").gsub(/\ */, "").split(",") |
View kick.sh
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
# kick function | |
# kicks other users out of their sessions with a message | |
# would kick root which comes from a defined destination | |
function kick() { | |
if [ -z "$1" ] | |
then | |
echo "need user" | |
return | |
fi |
View mailcheck.sh
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 | |
# scroll below for the bash script | |
mailcheck () { | |
# abort if no argument | |
if [ -z "$1" ] | |
then | |
echo "I need a SASL user name" | |
return | |
fi |
NewerOlder