Skip to content

Instantly share code, notes, and snippets.

View kamermans's full-sized avatar
😏

Steve Kamerman kamermans

😏
View GitHub Profile
@kamermans
kamermans / jmeter-server.sh
Last active December 5, 2018 08:01
Apache Jmeter Server init script for Ubuntu/Debian (tested on jmeter 2.6 and 2.7)
#!/bin/sh
### BEGIN INIT INFO
# Provides: jmeter-server
# Required-Start: $syslog $local_fs
# Required-Stop: $syslog $local_fs
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: Apache JMeter Remote Server
# Description: Apache JMeter Remote Server runs JMeter tests issued from a remote server.
### END INIT INFO
@kamermans
kamermans / pwrstatd-email.sh
Created September 18, 2012 20:08
Replacement for the CyberPower PowerPanel email notify script, which does not work on Ubuntu
#!/usr/bin/php
<?php
class EventWrapper {
public function __construct($vars) {
foreach ($vars as $name => $val) $this->$name = $val;
}
public function __get($name) {
return property_exists($this, $name)? $this->$name: null;
}
@kamermans
kamermans / build_mysql51.sh
Created November 3, 2012 22:07
Build MySQL 5.1 on Ubuntu 12.04 and later (5.1 is not available in Ubuntu repo)
#!/bin/bash
set -e
cd ~/
wget http://downloads.mysql.com/archives/mysql-5.1/mysql-5.1.65.tar.gz
tar -zxf mysql-5.1.65.tar.gz
cd mysql-5.1.65
./configure '--prefix=/usr' '--exec-prefix=/usr' '--libexecdir=/usr/sbin' '--datadir=/usr/share' '--localstatedir=/var/lib/mysql' '--includedir=/usr/include' '--infodir=/usr/share/info' '--mandir=/usr/share/man' '--with-system-type=debian-linux-gnu' '--enable-shared' '--enable-static' '--enable-thread-safe-client' '--enable-assembler' '--enable-local-infile' '--with-fast-mutexes' '--with-big-tables' '--with-unix-socket-path=/var/run/mysqld/mysqld.sock' '--with-mysqld-user=mysql' '--with-libwrap' '--without-readline' '--with-ssl' '--without-docs' '--with-extra-charsets=all' '--with-plugins=max' '--with-embedded-server' '--with-embedded-privilege-control'
make
@kamermans
kamermans / LinuxJournalDownloader.php
Last active August 13, 2019 14:38
Auto-downloader for Linux Journal ebooks. I set my download location to a directory that gets sync'd to my mobile devices (Dropbox, Box, SkyDrive, etc).
<?php
// Account number goes here
$account_num = 'LJ123456';
// Your ZIP code
$zip = '12345';
// Path to eBooks
$path = 'C:/eBooks/Linux Journal';
// eBook download format: pdf, epub, mobi
$format = 'pdf';
@kamermans
kamermans / find_dracs.sh
Created March 23, 2013 04:05
Find all the DRACs on your network
#!/bin/bash
nmap -sT --open -oG - -p 2068,5900 172.16.1.1-254 | grep open
@kamermans
kamermans / steve-configure.sh
Created September 29, 2013 01:09
Ubuntu 12.04.4 LTS, PHP 5.5.4 w/pthreads configure script
#!/bin/sh
./configure \
--prefix=/usr \
--with-apxs2=/usr/bin/apxs2 \
--with-config-file-path=/etc/php5/apache2 \
--with-config-file-scan-dir=/etc/php5/apache2/conf.d \
--build=x86_64-linux-gnu \
--host=x86_64-linux-gnu \
--sysconfdir=/etc \
@kamermans
kamermans / pthreads_example.php
Created September 29, 2013 02:09
An adaptation of an example from the pthreads project that shows how to make 32 simultaneous web requests in PHP using multi-threading via pthreads.
<?php
error_reporting(E_ALL);
class AsyncWebRequest extends Thread {
public $url;
public $num;
public $data;
public function __construct($url, $num){
$this->url = $url;
@kamermans
kamermans / build_docs.sh
Created October 19, 2013 19:38
Apigen install and build script for automated deployments
#!/bin/bash
cd "$( dirname "${BASH_SOURCE[0]}" )"
COMPOSER=$(which composer || echo "$(pwd)/../composer.phar")
if [ ! -f "$COMPOSER" ]; then
echo "Installing composer"
cd ..
curl -sS https://getcomposer.org/installer | php
@kamermans
kamermans / .bash_git
Last active December 26, 2015 03:59
Script that adds git status to the bash prompt.
# Git integration
# https://github.com/git/git/blob/master/contrib/completion/git-prompt.sh
# You should edit ~/.bashrc and set `force_color_prompt=yes`, then add
# this this to the end: if [ -f ~/.bash_git ]; then . ~/.bash_git; fi
LIGHT_WHITE="\[\033[1;37m\]"
WHITE="\[\033[0;37m\]"
GRAY="\[\033[1;30m\]"
BLACK="\[\033[0;30m\]"
RED="\[\033[0;31m\]"
@kamermans
kamermans / nginx
Created February 6, 2014 04:57 — forked from streamj/nginx
#!/bin/sh
#
# nginx - this script starts and stops the nginx daemon
#
# chkconfig: - 85 15
# description: Nginx is an HTTP(S) server, HTTP(S) reverse \
# proxy and IMAP/POP3 proxy server
# processname: nginx
# config: /usr/local/nginx/conf/nginx.conf
# pidfile: /usr/local/nginx/logs/nginx.pid