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
[user@workstation ~]% lsb_release -a | |
No LSB modules are available. | |
Distributor ID: Ubuntu | |
Description: Ubuntu 12.04.1 LTS | |
Release: 12.04 | |
Codename: precise | |
[user@workstation ~]% sudo apt-get install ipset | |
Reading package lists... Done | |
Building dependency tree | |
Reading state information... 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
#!/usr/bin/perl | |
use strict; | |
use warnings; | |
# Author: David J. Weller-Fahy | |
# Inspired by | |
# Placed in the public domain | |
my($field, $res_bytes, $res_pages, $value, $total); |
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
int | |
transformable_request (TSHttpTxn txnp) | |
{ | |
TSMBuffer req_bufp; | |
TSMLoc req_loc; | |
TSMLoc field_loc; | |
const char* user_agent_value = NULL; | |
int user_agent_length = -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
// | |
if (TSHttpTxnClientReqGet(txnp, &req_bufp, &req_loc) != TS_SUCCESS) { | |
TSError("couldn't retrieve client request header\n"); | |
return 0; | |
} | |
length_field_loc = TSMimeHdrFieldFind(req_bufp, req_loc, TS_MIME_FIELD_CONTENT_LENGTH, TS_MIME_LEN_CONTENT_LENGTH); | |
if (length_field_loc) { | |
TSMimeHdrDestroy(req_bufp, length_field_loc); |
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
length_field_loc = TSMimeHdrFieldFind(bufp, hdr_loc, TS_MIME_FIELD_CONTENT_LENGTH, TS_MIME_LEN_CONTENT_LENGTH); | |
if (length_field_loc) { | |
content_length = TSMimeHdrFieldValueUintGet(bufp, hdr_loc, length_field_loc, 0); | |
TSDebug(DBG_TAG, "Content-Length was: %u", content_length); | |
new_content_length = content_length + delta; | |
TSMimeHdrFieldValuesClear(bufp, hdr_loc, length_field_loc); | |
TSMimeHdrFieldValueUintInsert(bufp, hdr_loc, length_field_loc, -1, new_content_length); | |
// check value |
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
static int | |
handle_buffering(TSCont contp, MyData * data) { | |
TSVIO write_vio; | |
int towrite, towriteLeft, avail; | |
/* Create the output buffer and its associated reader */ | |
if (!data->output_buffer) { | |
data->output_buffer = TSIOBufferCreate(); | |
TSAssert(data->output_buffer); | |
data->output_reader = TSIOBufferReaderAlloc(data->output_buffer); |
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
#{ | |
# "kind": "urlshortener#url", | |
# "id": "http://goo.gl/lUmqp", | |
# "longUrl": "http://drops.from-me.org/" | |
#} | |
curl --silent https://www.googleapis.com/urlshortener/v1/url -H 'Content-Type: application/json' -d "{'longUrl': 'http://drops.from-me.org/$ofname'}" | awk -F\" '/"id"/ { printf "%s", $4 } ' | pbcopy |
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
pid = /var/run/stunnel.pid | |
socket = a:SO_REUSEADDR=1 | |
socket = l:TCP_NODELAY=1 | |
socket = r:TCP_NODELAY=1 | |
debug = 2 | |
[ssl_frontend] | |
client = no | |
key = /WOO/server1024.key | |
cert = /WOO/server1024.crt |
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
iostat -x 1 | awk 'BEGIN { count=0 } /^sd[a-d]/ { if (count == 0) print "Disk\tawait\tsvctm\t%util"; if (count <= 10) { count++ } else { count=0 }; printf( "%s\t%d\t %d\t%d\n", $1 ,$10 , $11, $12); }' |
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
screen -q -ls | |
if [ "$?" -gt 10 ]; then | |
echo | |
screen -ls | |
fi |