Skip to content

Instantly share code, notes, and snippets.

View vajapravin's full-sized avatar
😀
Available

vajapravin vajapravin

😀
Available
View GitHub Profile
@vajapravin
vajapravin / Sublime-text license key free
Created December 18, 2019 07:41
Sublime Text free license key
----- BEGIN LICENSE -----
Member J2TeaM
Single User License
EA7E-1011316
D7DA350E 1B8B0760 972F8B60 F3E64036
B9B4E234 F356F38F 0AD1E3B7 0E9C5FAD
FA0A2ABE 25F65BD8 D51458E5 3923CE80
87428428 79079A01 AA69F319 A1AF29A4
A684C2DC 0B1583D4 19CBD290 217618CD
5653E0A0 BACE3948 BB2EE45E 422D2C87
class PrimeNumber
def initialize
print 'Enter number: '
@num = gets.to_i
@primes = []
end
def generate
for i in (2..(@num**2)) do
for j in (2..i) do
@vajapravin
vajapravin / docker-cleanup-resources.md
Created June 14, 2018 12:39 — forked from bastman/docker-cleanup-resources.md
docker cleanup guide: containers, images, volumes, networks

Docker - How to cleanup (unused) resources

Once in a while, you may need to cleanup resources (containers, volumes, images, networks) ...

delete volumes

// see: https://github.com/chadoe/docker-cleanup-volumes

$ docker volume rm $(docker volume ls -qf dangling=true)

$ docker volume ls -qf dangling=true | xargs -r docker volume rm

prob1.rb
def getUserInput
gets.chomp.split(" ").map(&:to_i)
end
total_stops, vacant_seats = getUserInput
standing_stops = 0
(total_stops-1).downto(1) do |s|
stop = getUserInput
@vajapravin
vajapravin / 1_user.rb
Last active January 5, 2018 04:43 — forked from i-arindam/1_user.rb
class User < ApplicationRecord
has_many :posts
has_many :comments
# id :integer not null, primary key
# name :string(50) default("")
end
git clone https://github.com/nicehash/nheqminer.git
cd nheqminer/cpu_xenoncat/asm_linux/
chmod +x fasm
sh assemble.sh
cd ../../../
mkdir build && cd build
curl -sSL https://cmake.org/files/v3.5/cmake-3.5.2-Linux-x86_64.tar.gz | tar -xzC ./
cmake-3.5.2-Linux-x86_64/bin/cmake ../nheqminer/
tail -fn0 /var/log/auth.log | \
while read line ; do
echo "$line" | grep "password check failed for user"
if [ $? = 0 ]
then
echo "Wrong Login Attempt" | mail -s "Login Password Wrong - GigoLinux" vajapravin23@gmail.com
fi
done

Figure out a good standard for how to use the HTTP response codes in a 'truly RESTful' (Now called 'Hypermedia API' apparently) way.

Summary

#!/bin/sh
cd ~/rails_workspace/MyAwsmProject;
git filter-branch --env-filter '
OLD_EMAIL="john.wills@gmail.com"
CORRECT_NAME="foobar"
CORRECT_EMAIL="foo.bar@gmail.com"
if [ "$GIT_COMMITTER_EMAIL" = "$OLD_EMAIL" ]
then
@vajapravin
vajapravin / application_helper.rb
Last active April 12, 2016 12:48
How to upload image in AngularJS with Rails backend.
# Sorry for not explaining basic stuff
module ApplicationHelper
def decode_base64_image document
if document[:base64] && document[:filetype] && document[:filename]
decoded_data = Base64.decode64(document[:base64])
data = StringIO.new(decoded_data)
data.class_eval do
attr_accessor :content_type, :original_filename