These are a list of usages of shell commands I can't live without on UNIX-based systems.
Using Homebrew (yes, I am opinionated) you can install the following tools with the following packages:
| #!/bin/bash | |
| # bash generate random alphanumeric string | |
| # | |
| # bash generate random 32 character alphanumeric string (upper and lowercase) and | |
| NEW_UUID=$(cat /dev/urandom | tr -dc 'a-zA-Z0-9' | fold -w 32 | head -n 1) | |
| # bash generate random 32 character alphanumeric string (lowercase only) | |
| cat /dev/urandom | tr -dc 'a-z0-9' | fold -w 32 | head -n 1 |
| <?php | |
| // Get this at your MongoLab.com user page | |
| $MONGOLAB_API_KEY = 'XXXXXXXXXXXXXX'; | |
| $DB = 'mydb'; | |
| $COLLECTION = 'mycollection'; | |
| $name = $_POST['fullName']; | |
| $email = $_POST['email']; | |
| $phone = $_POST['phoneNumber']; | |
| $src = $_POST['src']; |
| #!/usr/bin/env bash | |
| cat /var/log/apache2/access_log | awk '{print $1}' > ips.txt | |
| uniq ips.txt > uniqips.txt | |
| IPS=`cat uniqips.txt` | |
| for i in $IPS | |
| do | |
| echo "$i,`geoiplookup $i | cut -d "," -f2 | sed -e 's/^[\t]//'`" >> ipinfo.csv | |
| done |
By default when Nginx starts receiving a response from a FastCGI backend (such as PHP-FPM) it will buffer the response in memory before delivering it to the client. Any response larger than the set buffer size is saved to a temporary file on disk.
This process is outlined at the Nginx ngx_http_fastcgi_module page manual page.
| #!/bin/bash | |
| MONGO_DATABASE="your_db_name" | |
| APP_NAME="your_app_name" | |
| MONGO_HOST="127.0.0.1" | |
| MONGO_PORT="27017" | |
| TIMESTAMP=`date +%F-%H%M` | |
| MONGODUMP_PATH="/usr/bin/mongodump" | |
| BACKUPS_DIR="/home/username/backups/$APP_NAME" |
| storage: | |
| dbPath: "./data" | |
| directoryPerDB: true | |
| journal: | |
| enabled: true | |
| engine: "wiredTiger" | |
| wiredTiger: | |
| engineConfig: | |
| cacheSizeGB: 8 | |
| journalCompressor: snappy |
| <?php | |
| # Demonstrates how to add new contact to campaign. | |
| # JSON::RPC module is required | |
| # available at http://github.com/GetResponse/DevZone/blob/master/API/lib/jsonRPCClient.php | |
| require_once 'jsonRPCClient.php'; | |
| # your API key is available at | |
| # https://app.getresponse.com/my_api_key.html |
| #!/bin/bash | |
| # cool_gpu2.sh This script will enable or disable fixed gpu fan speed | |
| # | |
| # Description: A script to control GPU fan speed on headless (non-X) linux nodes | |
| # Original Script by Axel Kohlmeyer <[email protected]> | |
| # https://sites.google.com/site/akohlmey/random-hacks/nvidia-gpu-coolness | |
| # | |
| # Modified for newer drivers and removed old work-arounds |