Skip to content

Instantly share code, notes, and snippets.

View tomasvitek's full-sized avatar
🤒
Out sick

Tomáš Vítek tomasvitek

🤒
Out sick
View GitHub Profile

Keybase proof

I hereby claim:

  • I am tomasvitek on github.
  • I am tomik (https://keybase.io/tomik) on keybase.
  • I have a public key whose fingerprint is BB25 6F55 97FC 40BF D117 A6D1 37BA 8410 BE4A 49AA

To claim this, I am signing this object:

@tomasvitek
tomasvitek / Simple PHP script to compress folder
Last active December 16, 2015 17:29
Simple utility which creates a zip archive with contents of the folder it is placed in. This script comes in handy when you don't have SSH access to your (shared) webserver. Upload the script to the webserver, open url `http://example.com/compress.php`. Script creates archive `http://example.com/__name-of-folder.zip`.
<?php
/**
* Compress a folder to a zip archive
*
* Simple utility which creates a zip archive with contents of the folder it is placed in.
* This script comes in handy when you don't have SSH access to your (shared) webserver.
* Upload the script to the webserver, open url `http://example.com/compress.php`.
* Script creates archive `http://example.com/__name-of-folder.zip`.
*
* @copyright Copyright (c) 2013 Tomas Vitek
@tomasvitek
tomasvitek / monit_raid_size
Last active December 15, 2015 17:48
UNIX monitoring system `monit` (http://mmonit.com/monit/) can check space usage on regular filesystems, but can't on a RAID filesystem. This script is a workaround. Usage: Copy `monit_raid_size` script to `/usr/local/bin` and make it executable, set a cron entry for it to 10 minutes and check for timestamp in `monitrc` configuration file.
#!/bin/bash
# Copy this file to `/usr/local/bin` and make this file executable.
# Set a cron entry for this script for 10 minutes (see `crontab` file bellow).
# The space usage limit
readonly PERCENT=90
if [ `df -h /dev/md0 | egrep -o '([[:digit:]]{1,3})%' | egrep -o '([[:digit:]]{1,3})' ` -lt PERCENT ] then
touch /var/tmp/monit_flag_raid
@tomasvitek
tomasvitek / Simple PHP zip archive extractor
Created April 3, 2013 04:06
Simple utility to unzip an archive remotely on a webserver. When you have to deploy a lot of files to a webserver with no SSH access, upload all files in a zip, upload this script and unzip by calling `http://example.com/extract.php?name_of_archive`.
<?php
/**
* Extracts a zip archive
*
* Simple utility to unzip an archive remotely on a webserver. When you have to deploy
* a lot of files to a webserver with no SSH access, upload all files in a zip, upload
* this script and unzip by calling `http://example.com/extract.php?name_of_archive`.
*
* @copyright Copyright (c) 2013 Tomas Vitek
* @author Tomas Vitek ~ http://tomasvitek.com