Skip to content

Instantly share code, notes, and snippets.

View RohitRox's full-sized avatar
🎯
Focusing

Rohit Joshi RohitRox

🎯
Focusing
View GitHub Profile
@RohitRox
RohitRox / Readme.md
Last active December 9, 2022 14:42 — forked from pdincau/readme.md
Study Path on microservices
@RohitRox
RohitRox / remove_ds_store_files.sh
Created March 25, 2019 13:58 — forked from jls/remove_ds_store_files.sh
Remove all of the .DS_Store files in the current directory and all sub directories.
find ./ -type f | grep .DS_Store | xargs rm
@RohitRox
RohitRox / find-ecr-image.sh
Created February 19, 2019 10:27 — forked from outofcoffee/find-ecr-image.sh
Check if Docker image exists with tag in AWS ECR
#!/usr/bin/env bash
# Example:
# ./find-ecr-image.sh foo/bar mytag
if [[ $# -lt 2 ]]; then
echo "Usage: $( basename $0 ) <repository-name> <image-tag>"
exit 1
fi
IMAGE_META="$( aws ecr describe-images --repository-name=$1 --image-ids=imageTag=$2 2> /dev/null )"
@RohitRox
RohitRox / clean-docker.sh
Created November 25, 2018 19:55 — forked from apmiller108/clean-docker.sh
Bash script to clean up docker
#!/bin/bash
GREEN='\x1B[32m'
RED='\x1B[31m'
NOCOL='\x1B[39m'
echo "${GREEN}Removing exited containers${NOCOL}"
docker rm -v $(docker ps --filter status=dead --filter status=exited -aq)
echo "${GREEN}Removing dangling images${NOCOL}"
docker rmi $(docker images -f "dangling=true" -q)
@RohitRox
RohitRox / attached_validator.rb
Created September 23, 2018 23:24 — forked from carlosramireziii/attached_validator.rb
A validator and RSpec matcher for requiring an attachment using Active Storage
class AttachedValidator < ActiveModel::EachValidator
def validate_each(record, attribute, value)
record.errors.add(attribute, :attached, options) unless value.attached?
end
end
# Sorts an array based on a property of each object within the array
#
# Examples:
#
# [Em.Object.create(a: 1), Em.Object.create(a: 5), Em.Object.create(a: 3)].sortProperty('a')
# > [{a: 1}, {a: 3}, {a: 5}]
#
# As a computed property:
#
# AC = Em.ArrayController.extend
.pagination a, .pagination span.current, .pagination span.gap {
float: left;
padding: 0 14px;
line-height: 38px;
text-decoration: none;
background-color: white;
border: 1px solid #DDD;
border-left-width: 0;
}
# .irbrc to log goodies like SQL/Mongo queries to $stdout if in Rails 3 console
if defined?(Rails) && Rails.respond_to?(:logger)
require 'logger'
Rails.logger = Logger.new($stdout)
if defined?(Mongoid)
Mongoid.logger = Rails.logger
end
end

Install Python

$ brew install readline sqlite gdbm
$ brew install python --universal --framework
$ python --version
Python 2.7

Symlinks...

# Only for Mac OS X, where .bashrc is otherwise ignored
if [ -f ~/.bashrc ]; then
source ~/.bashrc
fi
# MacPorts
export PATH=/opt/local/bin:/opt/local/sbin:$PATH
export MANPATH=/opt/local/share/man:$MANPATH