Skip to content

Instantly share code, notes, and snippets.

View samof76's full-sized avatar
๐Ÿ’
Swinging branches

Samuel Vijaykumar M samof76

๐Ÿ’
Swinging branches
View GitHub Profile
@samof76
samof76 / error.txt
Created August 17, 2018 07:17
Crashdump for a iex run
iex --name sam --cookie secret
2018-08-17 12:39:22.425266
args: []
format: "Can't set long node name!\nPlease check your configuration\n"
label: {error_logger,info_msg}
2018-08-17 12:39:22.425344 crash_report #{label=>{proc_lib,crash},report=>[[{initial_call,{net_kernel,init,['Argument__1']}},{pid,<0.59.0>},{registered_name,[]},{error_info,{exit,{error,badarg},[{gen_server,init_it,6,[{file,"gen_server.erl"},{line,358}]},{proc_lib,init_p_do_apply,3,[{file,"proc_lib.erl"},{line,249}]}]}},{ancestors,[net_sup,kernel_sup,<0.45.0>]},{message_queue_len,0},{messages,[]},{links,[<0.56.0>]},{dictionary,[{longnames,true}]},{trap_exit,true},{status,running},{heap_size,610},{stack_size,27},{reductions,833}],[]]}
2018-08-17 12:39:22.425812 supervisor_report #{label=>{supervisor,start_error},report=>[{supervisor,{local,net_sup}},{errorContext,start_error},{reason,{'EXIT',nodistribution}},{offender,[{pid,undefined},{id,net_kernel},{mfargs,{net_kernel,start_link,[[sam,longnames],true]}},{restart_type,per
@samof76
samof76 / math_fib.exs
Created August 14, 2018 13:41
Fibonacci List in Elixir
defmodule Math do
def fib(n) when n == 1, do: [0]
def fib(n) when n > 1, do: fib([0], n-1)
def fib([0], n), do: fib([1|[0]], n-1)
def fib(l,0), do: Enum.reverse(l)
def fib(l,n) do
[h1|[h2 | _]] = l
fib([h1+h2 | l], n-1)
end
end
#!/bin/bash
set -x
pushd /tmp
wget https://github.com/sribalakumar/bootchart/archive/master.zip
unzip master.zip
pushd bootchart-master
sh install.sh
sed -i 's/default=1/default=0/g' /boot/grub/menu.lst
popd
@samof76
samof76 / prepare_gold_instance.sh
Last active March 27, 2018 09:56
prepare gold instances
#!/bin/bash
/etc/init.d/monit stop
/etc/init.d/opsworks-agent stop
rm -rf /etc/aws/opsworks/ /opt/aws/opsworks/ /var/log/aws/opsworks/ /var/lib/aws/opsworks/ /etc/monit.d/opsworks-agent.monitrc /etc/monit/conf.d/opsworks-agent.monitrc /var/lib/cloud/ /etc/chef
rpm -e opsworks-agent-ruby
# rpm -e chef
# /etc/init.d/nginx stop
@samof76
samof76 / prepare_instance.sh
Last active September 1, 2017 05:35
This script will prepare instance before creating an AMI
#!/bin/bash
/etc/init.d/monit stop
/etc/init.d/opsworks-agent stop
rm -rf /etc/aws/opsworks/ /opt/aws/opsworks/ /var/log/aws/opsworks/ /var/lib/aws/opsworks/ /etc/monit.d/opsworks-agent.monitrc /etc/monit/conf.d/opsworks-agent.monitrc /var/lib/cloud/ /etc/chef
rpm -e opsworks-agent-ruby
rpm -e chef
/etc/init.d/nginx stop
@samof76
samof76 / install_redishappy.sh
Created October 6, 2016 05:45
RedisHappy install script
#!/bin/bash
set -e
function install_haproxy () {
echo "Install dependencies..."
sudo yum install wget git gcc pcre-static pcre-devel -y
echo "Download haproxy..."
pushd /tmp
wget http://www.haproxy.org/download/1.6/src/haproxy-1.6.3.tar.gz
@samof76
samof76 / sentinel.conf
Last active October 5, 2016 05:36
Redis sentinel configuration
port 26379
sentinel monitor mymaster 172.31.20.201 6379 1
sentinel down-after-milliseconds mymaster 10000
sentinel failover-timeout mymaster 20000
sentinel parallel-syncs mymaster 1
bind 0.0.0.0
dir "/tmp"
loglevel notice
logfile "/var/log/redis-sentinel.log"
daemonize yes
#!/bin/sh
# From - http://www.codingsteps.com/install-redis-2-6-on-amazon-ec2-linux-ami-or-centos/
#
# redis - this script starts and stops the redis-server daemon
# Originally from - https://raw.github.com/gist/257849/9f1e627e0b7dbe68882fa2b7bdb1b2b263522004/redis-server
#
# chkconfig: - 85 15
# description: Redis is a persistent key-value database
# processname: redis-server
# config: /etc/redis/redis.conf
@samof76
samof76 / redis.service
Created October 3, 2016 08:49
redis service startup file
[Unit]
Description=Redis In-Memory Data Store
After=network.target
[Service]
User=redis
Group=redis
ExecStart=/usr/local/bin/redis-server /etc/redis/redis.conf
ExecStop=/usr/local/bin/redis-cli shutdown
Restart=always
@samof76
samof76 / appmonitor.py
Created October 1, 2015 06:39
Crued way to monitor your Cloud Foundry application's resource utilization
from optparse import OptionParser
from time import sleep
import requests
def main():
parser = OptionParser(usage="usage %prog [options]", version="%prog 1.0")
parser.add_option("-d", "--domain",
action = "store",