Skip to content

Instantly share code, notes, and snippets.

View mredar's full-sized avatar

Mark Redar mredar

  • CDL
  • Oakland, CA
View GitHub Profile
@mredar
mredar / error_fixes.md
Created August 29, 2017 17:09
Error messages and fixes

boto

  • AttributeError: 'BlockDeviceType' object has no attribute 'encrypted' - upgrade to >=2.3.0
import readline
readline.write_history_file('my_history.py')
@mredar
mredar / show.bash
Created July 5, 2017 21:51
show command bash - will check aliases, functions and commands
function show
{
# Show the definition of the verb given in $1 e.g. `show ll` (alias) or
# `show show` (function) or `show who` (command).
verb=$1
alias $1 2>/dev/null \
|| declare -f $1 2>/dev/null \
|| /usr/bin/which $1 2>/dev/null \
|| echo "Unrecognized command '$1'"
@mredar
mredar / AWS_meta-data
Created June 20, 2017 18:07
AWS instance meta-data
curl http://169.254.169.254/latest/meta-data/
curl http://169.254.169.254/latest/meta-data/local-ipv4
@mredar
mredar / find_replace_sed
Created May 3, 2017 17:49
Find and replace text in multiple files from linux CLI
grep -rli 'old-word' * | xargs -i@ sed -i 's/old-word/new-word/g' @
ps -fA|grep ssh|awk '{print $2}'|xargs -I {} kill {}
@mredar
mredar / delete_collection.txt
Created February 17, 2016 22:59
Solr delete query
https://52.10.100.133/solr/dc-collection/update?stream.body=<delete><query>collection_url:"https://registry.cdlib.org/api/v1/collection/26198/"</query></delete>&commit=true
@mredar
mredar / x
Created June 25, 2015 22:54
Collections with missing images for "image" type docs
{
"responseHeader":{
"status":0,
"QTime":112,
"params":{
"facet.query":"true",
"q":"-reference_image_md5:[* TO *]",
"facet.field":"collection_url",
"indent":"true",
"fq":"type_ss:\"image\"",
Setup the tunnel:
ssh -i <identity file for bastion> -L <localport>:<endpoint ip or name>:<endpoint ssh port or other port> <bastion user>@<ssh bastion server>
Then from local machine connect to local port which will be forwarded to endpoint
ssh -i <identity file for endpoint> <endpoint user>@localhost -p <localport from above>
@mredar
mredar / 0_reuse_code.js
Last active August 29, 2015 14:16
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console