Skip to content

Instantly share code, notes, and snippets.

Suresh Prajapati toddlers

Block or report user

Report or block toddlers

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View web-servers.md

Each of these commands will run an ad hoc http static server in your current (or specified) directory, available at http://localhost:8000. Use this power wisely.

Discussion on reddit.

Python 2.x

$ python -m SimpleHTTPServer 8000
@toddlers
toddlers / ec2tags.rb
Created Jul 8, 2013
Hack to get ec2 tags to facter. Depends on aws-cli (https://github.com/aws/aws-cli), jq (http://stedolan.github.io/jq/) and the JSON RubyGem (http://rubygems.org/gems/json)
View ec2tags.rb
require 'facter'
require 'json'
if Facter.value("ec2_instance_id") =! nil
instance_id = Facter.value("ec2_instance_id")
tags = Facter::Util::Resolution.exec("aws ec2 describe-tags --filters \"name=resource-id,values=#{instance_id}\" --region sa-east-1 | jq '[.Tags[] | {key: .Key, value: .Value}]'")
parsed_tags = JSON.parse(tags)
parsed_tags.each do |tag|
fact = "ec2_tag_#{tag["key"]}"
View about.md
@toddlers
toddlers / git_file_delete.txt
Created Jul 12, 2013
You can use the — option in git log to see the commit history for a file, even if you have deleted the file.
View git_file_delete.txt
# see the changes for a file, even if it was deleted
git log -- [file_path]
# limit the output to only the last commit that touched the file
git log -1 -- [file_path]
# include some statistics, eg. how many files were deleted
git log -1 --stat -- [file_path]
View oozie.txt
Apache Oozie
=============
What is Oozie
--------------
Oozie is an extensible, scalable and reliable system to define, manage, schedule, and execute complex Hadoop workloads via web services. More specifically, this includes:
* XML-based declarative framework to specify a job or a complex workflow of dependent jobs.
* Support different types of job such as Hadoop Map-Reduce, Pipe, Streaming, Pig, Hive and custom java applications.
@toddlers
toddlers / golangsetup.sh
Created Jul 23, 2013
setting up golang on mac osx
View golangsetup.sh
# OS X Go Setup
# Assumes:
# + Homebrew has been installed correctly.
# + Homebrew-cask has been tapped and installed correctly.
# Install Go lang latest (1.1.1 as of May 13, 2013)
###############################################################################
brew install go
View config.erb
<% if @colo == "a" then -%>
server server1 foo1.com:8088 check port 8088 inter 5000 rise 2 fall 3 maxconn 5000
server server2 foo2.com:8088 check port 8088 inter 5000 rise 2 fall 3 maxconn 5000
server server3 foo3.com:8088 check port 8088 inter 5000 rise 2 fall 3 maxconn 5000
<% elsif @colo == "b" then -%>
server server1 foo1.com:8088 check port 8088 inter 5000 rise 2 fall 3 maxconn 5000
server server2 foo2.com:8088 check port 8088 inter 5000 rise 2 fall 3 maxconn 5000
server server3 foo3.com:8088 check port 8088 inter 5000 rise 2 fall 3 maxconn 5000
<% elsif @colo == "c" then -%>
server server1 foo1.com:8088 check port 8088 inter 5000 rise 2 fall 3 maxconn 5000
@toddlers
toddlers / haproxy.conf
Last active Dec 12, 2018
haproxy config with directives explained
View haproxy.conf
global
log 127.0.0.1 local1 info info
user haproxy
group haproxy
daemon
#quiet
#debug
stats socket /var/run/haproxy/haproxy.sock mode 0600 level admin
defaults
@toddlers
toddlers / haproxy_add_remove.txt
Created Jul 25, 2013
Adding servers in haproxy without restarting haproxy
View haproxy_add_remove.txt
Adding a serverA ipA:portA to the 'query_backend':
echo "add server query_backend/serverA ipA:portA check inter 3000 rise 2 fall 3 maxconn 50" | socat stdio unix-connect:/var/haproxy.socket
Removing serverA again:
echo "remove server query_backend/serverA" | socat stdio unix-connect:/var/haproxy.socket
@toddlers
toddlers / git-loglive.sh
Created Aug 2, 2013
watching live logs of git repo
View git-loglive.sh
#!/bin/bash
while :
do
clear
git --no-pager log --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%ci) %C(bold blue)<%an>%Creset' --abbrev-commit --date=relative --all
sleep 1
done
You can’t perform that action at this time.