Skip to content

Instantly share code, notes, and snippets.

View adityashedge's full-sized avatar

Aditya Shedge adityashedge

View GitHub Profile
@adityashedge
adityashedge / watermark_with_image.rb
Last active December 11, 2023 14:46
Watermark images with ImageMagick 'convert' using 'composite', 'watermark' and 'dissolve' in Ruby
# Watermarking image with another image using Imagemagick 'composite', 'watermark' and 'dissolve'.
require "RMagick"
# Read the image in the memory with RMagick
img = Magick::Image.read("/home/aditya/Pictures/old_england_pic.jpg").first
# the original image was in jpg format
# need to make the white background color transparent
# also changed the format to png since JPG does not support transparency.
# run the command below to create an image with transparent background using ImageMagick
@adityashedge
adityashedge / mr-IN.yml
Created May 8, 2015 13:05
Marathi (mr-IN) locale file
# Marathi (mr-IN) translations for Rails
# by Aditya Shedge (shedge.aditya@gmail.com)
# http://en.wikipedia.org/wiki/Marathi_language
mr-IN:
date:
abbr_day_names:
- सोम
- मंगळ
- बुध
@adityashedge
adityashedge / keybase.md
Last active October 4, 2016 09:36
Keybase

Keybase proof

I hereby claim:

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

To claim this, I am signing this object:

@adityashedge
adityashedge / greed.rb
Created January 18, 2017 14:04
Greed 🎲 game
MIN_PLAYERS = 2
FINAL_ROUND_SCORE = 3000
class Player
attr_reader :attempts, :total
attr_accessor :name, :can_accumulate_points
def initialize
@turns = []
@total = 0
@adityashedge
adityashedge / rover.rb
Created January 20, 2017 10:14
Mars rover 🚀 problem
DIRECTIONS = ['N', 'E', 'S', 'W']
CONTROLS = ['L', 'R', 'M']
MOVES = {
'N' => {'L' => 'W', 'R' => 'E'},
'E' => {'L' => 'N', 'R' => 'S'},
'S' => {'L' => 'E', 'R' => 'W'},
'W' => {'L' => 'S', 'R' => 'N'}
}
class GridError < StandardError; end
@adityashedge
adityashedge / key_server.rb
Created January 20, 2017 16:09
Key Server 🔑
require 'sinatra'
require 'json'
BLOCKING_TIME = 60
EXPIRY_TIME = 300
all_keys = {}
blocked_keys = []
available_keys = []
@adityashedge
adityashedge / nodeschool-workshop-crawler.js
Created January 30, 2017 19:46
JS crawler to get description and NPM package for all the 'nodeschool' workshops.
/*
"dependencies": {
"cheerio": "^0.22.0",
"request": "^2.79.0"
}
*/
const request = require('request');
const cheerio = require('cheerio');