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
### dev_setup.sh: | |
#/bin/bash | |
# | |
# Sets up your environment! | |
# Adds all necessary services and automates a few things.. | |
## | |
## prerequisites | |
if [ ! -d /usr/local/Homebrew ]; then |
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
charlie@barrel(~)% cat /usr/local/bin/inotify_unzip_things.sh 10.03 | |
#!/bin/bash | |
dir='/stash/stash/3D Printing' | |
cd "$dir" | |
while [ 1 ]; do | |
inotifywait -m "$dir" -e create --format '%f'| | |
while read -r file; do | |
sleep 1 | |
if [[ "$file" =~ ^.*\.zip$ ]]; then | |
name=`basename "$file" .zip` |
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
import requests | |
from influxdb import InfluxDBClient | |
URL="http://localhost:9090/api/v1/query?query={metric}[{range}]" | |
client = InfluxDBClient(host='localhost', port=8086) | |
client.switch_database('lendy') | |
measurements = ["account_balance", "account_balance_available", "active_offer_amount", "active_offer_count", "alltime_earnings_apr", "assets_under_management", "bot_errors", "bot_last_ran_seconds_ago", "bot_run_times", "bot_runs", "capital_working", "daily_earning", "days_for_current_rate", "exchange_rate", "exchange_volume", "frr_amount", "frr_rate", "lend_buckets", "lend_depth_minutes", "lend_rate", "lend_rate_max", "lend_rate_min", "lend_volume", "lendbook_total", "loan_average_length", "loan_average_seconds_left", "loan_count", "loan_days_bucket", "loan_days_count", "loan_days_sum", "loan_hourly_earnings", "loan_weighted_rate", "offers_cancelled", "offers_filled", "percentile_days", "percentile_hours", "rate_floor_apr", "total_bot_runs", "total_loan_earnings", "total_loans", "total_loans_amount", ] | |
for me |
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/python | |
""" | |
Script to fetch SPOT url and: 1) save lat,lon coordinates to a file, 2) save all spot messages as JSON, 3) and xml as well. | |
Files get re-written on every run, if there's new data. Oh, it writes to stderr if batteryState isn't GOOD - so if you run from cron, you'll get email when your spot batteries need to be changed. | |
""" | |
import urllib2 | |
import json | |
import sys | |
""" Edit these items: """ |
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
#!/bin/bash | |
# | |
# runs the provided script/arguments with bash -x, and prints ALL stderr/stdout | |
# (bash -x output) if any stderr is present. Otherwise, it silently exits. | |
# | |
output=/tmp/output-$$ | |
# send stdout + stderr to the logfile, in order, and let stderr flow through. | |
# run in a sub-process, so the re-mapped stdout/stderr file descriptors are |
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/env kpython | |
import time | |
import boto.dynamodb | |
conn = boto.dynamodb.connect_to_region('us-east-1') | |
table = conn.get_table('test_rtb_user_data') | |
start_time = time.time() | |
table.update_throughput(read_units=50, write_units=10) |
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
waiting for dynamodb to update provisioned capacity... | |
ACTIVE 50 80 took: 45.4535069466 | |
ops-dev005(~)% !vi | |
vi dynamo.py | |
ops-dev005(~)% ./dynamo.py | |
waiting for dynamodb to update provisioned capacity... | |
ACTIVE 50 100 took: 65.5947580338 | |
ops-dev005(~)% !vi | |
vi dynamo.py | |
ops-dev005(~)% ./dynamo.py |
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/local/share/python/pep8 --ignore=E501 handlers.py | |
handlers.py:24:1: E302 expected 2 blank lines, found 1 | |
handlers.py:27:12: E221 multiple spaces before operator | |
handlers.py:30:64: E502 the backslash is redundant between brackets | |
handlers.py:31:29: E127 continuation line over-indented for visual indent | |
handlers.py:34:36: E201 whitespace after '(' | |
handlers.py:34:46: E202 whitespace before ')' | |
handlers.py:47:21: E127 continuation line over-indented for visual indent | |
handlers.py:53:44: E502 the backslash is redundant between brackets | |
handlers.py:57:73: E502 the backslash is redundant between brackets |
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
import boto.vpc | |
def get_subnet_id(vpc_conn, vpc_id, zone): | |
subnets = vpc_conn.get_all_subnets(filters={'availabilityZone': zone}) | |
return subnets | |
az = 'us-east-1a' |
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
cc001(...dules/kconsole/manifests)% pssh.py --timeout=9999 --query '--region=us-east-1 Name:apiservices-a01' 'grep Finished /var/log/syslog' | |
matched the following hosts: apiservices-a017.krxd.net, apiservices-a014.krxd.net, apiservices-a018.krxd.net, apiservices-a015.krxd.net, apiservices-a013.krxd.net, apiservices-a016.krxd.net, apiservices-a010.krxd.net, apiservices-a012.krxd.net, apiservices-a011.krxd.net | |
[apiservices-a017.krxd.net] | |
STDOUT: | |
Apr 19 15:49:43 apiservices-a017 puppet-agent[4058]: Finished catalog run in 545.79 seconds | |
[apiservices-a018.krxd.net] | |
STDOUT: | |
Apr 19 15:53:28 apiservices-a018 puppet-agent[4047]: Finished catalog run in 564.96 seconds |
NewerOlder