Skip to content

Instantly share code, notes, and snippets.

Keybase proof

I hereby claim:

  • I am sarvin on github.
  • I am sarvin (https://keybase.io/sarvin) on keybase.
  • I have a public key ASAMBvo_3b3fwhmL0i7XVlE32Wpq1hAadUlsNv1XCKNVlAo

To claim this, I am signing this object:

@sarvin
sarvin / ssh_proxy_config_example
Last active May 1, 2018 17:42
Example SSH proxy with alternate SSH key
Host proxy_server
HostName proxy.server.com
User a_example.user
Host ecldr_asset38
HostName 11.111.111.11
port 22
User b_example.user
ProxyCommand ssh -W %h:%p proxy_server
IdentityFile %d/.ssh/proxy_server/id_rsa
@sarvin
sarvin / AWS Docker ECR Login
Created April 12, 2018 18:36
Log in to AWS ECR w/out displaying password while viewing process'
aws ecr get-authorization-token --query 'authorizationData[].authorizationToken' --output text | base64 -D | cut -d: -f2 | docker login -u AWS <Repository URI Goes Here> --password-stdin
@sarvin
sarvin / view_s3_buckets.py
Last active January 16, 2017 04:19
Parse S3 Loadbalancer Logs
import argparse
import boto3
import csv
import dateutil.parser
import logging
import sys
import time
class bcolors:
HEADER = '\033[95m'
@sarvin
sarvin / aws_instance_types_per_availability_zone.py
Created December 28, 2016 04:35
Find all possible reserved instance types in your availability zone
import boto3
### inspriation comes from http://aws-blog.io/2015/ec2-instance-type-availability/
### This is the only zone I have available,
### set your region to something you use
aws_client = boto3.client('ec2', region_name='us-east-1')
def get_regions():
regions = aws_client.describe_regions()
@sarvin
sarvin / unrar_dir.pl
Last active April 11, 2016 19:28
Automate finding the correct .rar file to pass to unrar -e
#!/usr/bin/perl -w
use strict;
use Getopt::Long;
use File::Find;
use Data::Dumper;
use File::Copy;
my $directory = '';
my $extract_dir = './';
@sarvin
sarvin / Example Crontab
Created March 2, 2016 05:16
Flexget setup
0,30 * * * * /usr/local/bin/flexget --cron -c /home/USER GOES HERE/.flexget/config.yml execute >> /home/USER GOES HERE/.flexget/flexget.log
@sarvin
sarvin / settings.json
Last active March 2, 2016 05:05
Transmission Configuration File
{
"alt-speed-down": 50,
"alt-speed-enabled": false,
"alt-speed-time-begin": 540,
"alt-speed-time-day": 127,
"alt-speed-time-enabled": false,
"alt-speed-time-end": 1020,
"alt-speed-up": 50,
"bind-address-ipv4": "0.0.0.0",
"bind-address-ipv6": "::",
@sarvin
sarvin / vagrant_box_prompt.txt
Last active March 8, 2016 15:40
My Vagrant Box Prompt
export PS1='\[\e[1;31m\]\u\[\e[1;34m\]\w>\[\e[m\]'
@sarvin
sarvin / mongorc.js
Created February 22, 2016 16:18
Dev mongorc.js
db = new Mongo('172.16.103.10').getDB("ecl");
DBQuery.prototype._prettyShell = true;
var host = db.serverStatus().host;
var prompt = function() { return db+"@"+host+"> "; }
size_of_all_collections = function() {
db.getCollectionNames().forEach(function(collname) {
var count = db[collname].count();
var collectionCount = collname.concat(': ', count);