Steve Stonebraker posted this in bash, Uncategorized on March 17th, 2014 Using you Roku at a hotel can be problematic because you are unable to accept the terms of service when using the internet. This post explains how to use a Roku at a Hotel.
These instructions can be followed pretty much verbatim for any other device (wii u, xbox, etc).
Instructions Go to “Settings”, and . . . → Read More: Howto Use Roku at a Hotel
Steve Stonebraker posted this in bash, Linux, Redhat Centos, Server Setup, Ubuntu on August 23rd, 2013 Add Current PATH to crontab
Are you sick of your cron job failing because you are not explicitly listing the full path of everything in your shell script? Here’s how to fix it!
Problem
Your script works when you run it from the console but fails in cron.
Cause
Your crontab doesn’t have the right . . . → Read More: Add Current PATH to crontab
Steve Stonebraker posted this in bash, Redhat Centos, Ubuntu on August 20th, 2013 How to create a bash script that deletes itself
This script will delete itself via the shred command (secure deletion) when it exits
#!/bin/bash # # Author: Steve Stonebraker # Date: August 20, 2013 # Name: shred_self.sh # Purpose: securely self-deleting shell script # http://brakertech.com/self-deleting-bash-script currentscript=$0 # function that is called when the script exits . . . → Read More: self deleting bash script
Steve Stonebraker posted this in bash, Linux, Mac, Redhat Centos, Ubuntu on August 1st, 2013 Recently I needed to calculate the starting and ending memory addresses of an IOS application (in order to dump it). As a result i needed to figure out how to add two hex addresses. Here’s what I discovered.
Basic Example
In this case we are adding 0x4f000 and 0x2000
$ printf “0x%X\n” $(( 0x4f000+0x2000 )) . . . → Read More: Howto Add Hex Numbers via Command Line
Steve Stonebraker posted this in bash, Redhat Centos, Ubuntu on July 23rd, 2013 Here’s my bash cheat sheet:
Tests Combining [ condition ] && action; # action executes if condition is true. [ condition ] || action; # action executes if condition is false. Filesystem related tests
We can test different filesystem related attributes using different condition flags as follows:
[ -f $file_var ]: Returns true if the . . . → Read More: Bash Cheat Sheet
Steve Stonebraker posted this in bash, Defense, Linux, Redhat Centos, Security, Server Setup, Ubuntu on June 24th, 2013 Goal: Whitelist an Entire Country with ipset For this article i’ll be referencing the github repository I set up at
https://github.com/ssstonebraker/braker-scripts/tree/master/working-scripts/ipset We have a few files there, specifically: * cidr_to_ipset.sh (a script to create an ipset ruleset) * Some example CIDR blocks for Italy (IT.txt), Spain (ES.txt), Great Britian (GB.txt), USA (US.TXT) * sample_firewall.txt (example . . . → Read More: Whitelist Entire Country with ipset
Steve Stonebraker posted this in Linux, Mongo, Ubuntu on May 3rd, 2013 To make Mongo DB SSL on Ubuntu 12.04 you need to either purchase it or compile from source.
To make compiling from source easy here’s a script to help you out!
Mongo Compile SSL from Source Script
Note: Make sure you are not running an EC2 Small instance or you will run out of space!
. . . → Read More: Howto make Mongo SSL on Ubuntu 12.04
Steve Stonebraker posted this in bash, FreeBSD, Linux, O/S, perl, Redhat Centos, Scripts, Server Setup on January 18th, 2013 Recently I tried passing a bash variable to perl command in bash script, it didn’t end well.
Troy Engel from http://tacticalvim.wordpress.com/ was nice enough to point out the issue:
use sed instead of perl for what you need; it’s simpler, faster and uses the bash variables easily.
I set up a test script /home/someuser/test.sh to . . . → Read More: passing bash variable to perl command in bash script
Steve Stonebraker posted this in Admin, MYSQL, php, Wordpress on December 4th, 2012 Goal: Update wordpress post with PHP cli < ?php $con = mysql_connect("localhost","root","[redacted]"); if (!$con) { echo "Unable to connect to DB: " . mysql_error(); exit; } if (!mysql_select_db("wordpress")) { echo "Unable to select mydbname: " . mysql_error(); exit; } $myfileText = mysql_real_escape_string(file_get_contents('./code_for_wordpress.html',true)); $sql = "UPDATE `[your_instance_prefix]_posts` SET `post_content` = '$myfileText' WHERE `ID` like '1397';"; $result . . . → Read More: php mysql update variable
Steve Stonebraker posted this in Apache, bash, Linux, Redhat Centos on October 26th, 2012 Objective: Prep dev httpd.conf for production
Tasks:
Remove jenkins virtual host entry (which starts with a comment line “#Start Jenkins”) Replace .dev with nothing (ex: www.dev.example.com becomes www.example.com) Replace debug with error (ex: Loglevel debug becomes Loglevel error) Sed to remove lines after match
In this example we will use sed delete all lines after . . . → Read More: sed delete all lines after
|
|