Skip to content

Instantly share code, notes, and snippets.

1. Write a command line program that takes an input string, and returns which
character is consecutively repeated the most times. If multiple characters
repeat the same number of time, return all those characters.
For ex: "aaddddffffaa" will return 'f, d'
For ex: "cat dog ___" will return '_'
SOLUTION :
user_input = gets.chomp
@Tapan
Tapan / abc
Last active August 29, 2015 14:05
Argument
Net::SSH.start(name, 'user') do |session|
session.exec!('file.rb')
end
file.rb
-----------------
module M1
module M2
class Sport
@Tapan
Tapan / nginx
Created February 23, 2017 10:48 — forked from tejasbubane/nginx
nginx logrotate script for centOS. Location: /etc/logrotate.d/nginx. Later change /etc/logrotate.conf add daily and change or comment "rotate" number (preferably comment to keep all log files -> symlinked to /mnt so no space issue)
/opt/nginx/logs/*.log {
daily
missingok
rotate 52
compress
delaycompress
notifempty
create 640 root adm
sharedscripts
postrotate
@Tapan
Tapan / gist:6ffef7767f5b498a496b8a64038d8513
Last active July 5, 2017 05:33
Add log rotate for services in linux
https://www.cyberciti.biz/faq/how-do-i-rotate-log-files/
http://www.linuxcommand.org/man_pages/logrotate8.html
https://gorails.com/guides/rotating-rails-production-logs-with-logrotate
Test new added logrotation policy
logrotate -vf /etc/logrotate.d/custom
@Tapan
Tapan / presto
Last active November 3, 2017 09:49
Presto installation
Installation
https://teradata.github.io/presto/docs/141t/server-installation.html
http://teradata.github.io/presto/docs/127t/installation/installation-ambari.html
Adding public key to clusters
https://teradata.github.io/presto/docs/141t/installation/presto-admin/ssh-configuration.html#ssh-configuration-label
Reference
http://teradata.github.io/presto/docs/127t/installation/installation-ambari.html
https://teradata.github.io/presto/docs/current/getting-started.html
@Tapan
Tapan / linux
Last active February 22, 2018 06:10
Linux
#add non-root user with root privileges
sudo adduser linux
sudo passwd linux
linuxpasswd
sudo visudo
linux ALL=(ALL) ALL
#Nginx
@Tapan
Tapan / resque
Last active July 7, 2017 04:08
Resque
# check resque info from console
Resque.info
# start redis server
redis-server
# start workers
VVERBOSE=1 QUEUE=queue_name rails environment resque:work
#
@Tapan
Tapan / ansible
Created July 25, 2017 04:33
ansible
https://opensource.com/article/17/7/automate-sysadmin-ansible
https://code.tutsplus.com/articles/an-introduction-to-slim-templates--cms-26028
https://code.tutsplus.com/articles/ruby-templating-with-slim-part-2--cms-26094
https://richonrails.com/articles/the-slim-template-engine
http://eggbox.fantomfactory.org/pods/afSlim/doc/
@Tapan
Tapan / spinner.md
Created September 1, 2017 08:49 — forked from danjellesma/spinner.md
Rails 4: Adding a spinner on link clicks

In Rails 4 it is useful to have a 'page loading' indicator when a user clicks a link. This is a simple way to accomplish that without external libraries. Tested on Rails 4 using TurboLinks.

Great Link for Spinning Loader gifs: http://loading.io/


On CSS Page:
.modal {
    display:    none;
 position: fixed;