Skip to content

Instantly share code, notes, and snippets.

Avatar
😀
Available

vajapravin vajapravin

😀
Available
View GitHub Profile
@vajapravin
vajapravin / Sublime-text license key free
Created Dec 18, 2019
Sublime Text free license key
View Sublime-text license key free
----- 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
View prime_number.rb
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 Jun 14, 2018 — forked from bastman/docker-cleanup-resources.md
docker cleanup guide: containers, images, volumes, networks
View docker-cleanup-resources.md

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
View questions
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
View 1_user.rb
class User < ApplicationRecord
has_many :posts
has_many :comments
# id :integer not null, primary key
# name :string(50) default("")
end
View nheqminer.sh
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/
View REST & Hypermedia APIs.md

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

Summary

View How to modify git log history
#!/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 Apr 12, 2016
How to upload image in AngularJS with Rails backend.
View application_helper.rb
# 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
View notify_wrong_ubuntu_login_attempt.sh
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
You can’t perform that action at this time.