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
// Use Gists to store code you would like to remember later on | |
console.log(window); // log the "window" object to the console |
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 | |
use macropage\helper\crate as crate; | |
/** | |
* Class Mode_nagios_cratedb | |
*/ | |
class Mode_nagios_crate_db_cluster_status extends Mode_nagios { | |
public function crate_db_cluster_status() { |
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
#!/usr/bin/perl | |
use strict; | |
use DBI; | |
my $rootpwd_from = ''; | |
my $rootpwd_to = ''; | |
my $dbh = DBI->connect('DBI:mysql:mysql;host=localhost', 'root', $rootpwd_from, { RaiseError => 1,mysql_socket=> '/var/run/mysqld/mysqld.sock' } ); |
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 | |
#echo -n "MySQL username: " ; read username | |
#echo -n "MySQL password: " ; stty -echo ; read password ; stty echo ; echo | |
mysql -NBe "SHOW DATABASES;" | grep -v 'lost+found' | while read database ; do | |
mysql -NBe "SHOW TABLE STATUS;" $database | while read name engine version rowformat rows avgrowlength datalength maxdatalength indexlength datafree autoincrement createtime updatetime checktime collation checksum createoptions comment ; do | |
if [ "$datafree" -gt 0 ] ; then | |
fragmentation=$(($datafree * 100 / $datalength)) | |
echo "$database.$name is $fragmentation% fragmented." |
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 function testUnbound() | |
{ | |
$xml = ' | |
<xs:schema targetNamespace="http://www.example.com" xmlns:xs="http://www.w3.org/2001/XMLSchema"> | |
<xs:element name="packet"> | |
<xs:complexType> | |
<xs:complexContent> | |
<xs:extension base="RequestPacketType"> | |
<xs:sequence> | |
<xs:choice maxOccurs="unbounded"> |
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/sh | |
x=$(find -name '*[A-Z]*'); | |
for i in $x; do | |
if [ -f "$i" ] | |
then | |
LOWER=$(echo "$i"|tr [:upper:] [:lower:]); | |
echo "move ${i} to ${LOWER}"; | |
mv $i $LOWER | |
fi | |
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
#!/bin/sh | |
SLACK_HOSTNAME="XXX.slack.com" | |
SLACK_URL="https://hooks.slack.com/services/XXXXXXXXXX" | |
SLACK_CHANNEL="@....." | |
SLACK_BOTNAME="XXXXXX" | |
OUTPUT=$(ps ax|grep "$1"|grep -v grep|grep -v $0) | |
if echo "$OUTPUT" | egrep -q "$1" ; then | |
echo "Still running: $1!" |
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 | |
AWS_ACCESS_KEY_ID=xxxxxxxx | |
AWS_SECRET_ACCESS_KEY=xxxxxxxxxx | |
PASSPHRASE=xxxxxxxxxxx | |
# directories, space separated | |
SOURCE="/mnt/home/" | |
BUCKET=s3+http://xxxxxxxxxx | |
BUCKETS3=s3://xxxxxxxxxxx | |
LOGFILE=/mnt/var/log/duplicity.log |
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 | |
# a shell script that keeps looping until an exit code is given | |
# if it does an exit(0), restart after a second - or if it's a declared error | |
# if we've restarted in a planned fashion, we don't bother with any pause | |
# and for one particular code, exit the script entirely. | |
# The numbers 97, 98, 99 must match what is returned from the PHP script | |
php xxxxxxxx.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
<?php | |
// User defined (only part where something needs to be changed) | |
$fritzbox_User = 'user'; | |
$fritzbox_Password = 'pass'; | |
// | |
// /* AVM Fritz!Box Dect 200 actuator set script user303 on http://www.harmony-remote-forum.de/ | |
// Parameters used fpr request in URL http://nas:800/fritz.php?actname=Media&action=on actname = <name of the AVM DECT actor as defined in the Fritz!Box GUI> action = on | off | toggle | poll (poll checks the current state of the actuator 0=off 1=on) | |
// Ressources https://avm.de/fileadmin/user_upload/Global/Service/Schnittstellen/AHA-HTTP-Interface.pdf Commands are sent via HTTP GET Request to the following URL | |
// http://fritz.box/webservices/homeautoswitch.lua?ain=<ain>&switchcmd=<cmd>&sid=<sid> (!) |
OlderNewer