Skip to content

Instantly share code, notes, and snippets.

{
"auto_complete_commit_on_tab": true,
"auto_complete_delay": 0,
"bold_folder_labels": true,
"caret_style": "wide",
"color_scheme": "Packages/User/Monokai (SL).tmTheme",
"draw_white_space": "all",
"ensure_newline_at_eof_on_save": true,
"highlight_line": true,
"highlight_modified_tabs": true,
@sharmaansh21
sharmaansh21 / gist:f02c961d14825ebf31c1
Created August 12, 2014 05:16
jenkins bash script
#!/bin/bash -x
export RAILS_ENV=test
bundle install
read -d '' database_yml <<"EOF"
login: &login
adapter: mysql2
username: builds
password:
In this step, we need to choose the physical volumes that will be used to create the LVM. We can create the physical volumes using pvcreate command as shown below.
1- pvcreate /dev/xvde /dev/xvdf
pvscan pvdisplay
Volume groups are nothing but a pool of storage that consists of one or more physical volumes. Once you create the physical volume, you can create the volume group (VG) from these physical volumes (PV).
In this example, the volume group vol_grp1 is created from the two physical volumes as shown below
2- vgcreate datavol /dev/xvde /dev/xvdf
vgdisplay
#---------------------------------------------------------------------
#
# Parse the response from Sonatype Nexus in order to determine the
# correct URI for the most recent snapshot of an artifact.
#
# Usage:
# ruby get_latest_snapshot.rb \
# -n http://localhost:8080/nexus \
# -g uk.co.scattercode \
# -a my-artifact \

Benchmarking Nginx with Go

There are a lot of ways to serve a Go HTTP application. The best choices depend on each use case. Currently nginx looks to be the standard web server for every new project even though there are other great web servers as well. However, how much is the overhead of serving a Go application behind an nginx server? Do we need some nginx features (vhosts, load balancing, cache, etc) or can you serve directly from Go? If you need nginx, what is the fastest connection mechanism? This are the kind of questions I'm intended to answer here. The purpose of this benchmark is not to tell that Go is faster or slower than nginx. That would be stupid.

So, these are the different settings we are going to compare:

  • Go HTTP standalone (as the control group)
  • Nginx proxy to Go HTTP
  • Nginx fastcgi to Go TCP FastCGI
  • Nginx fastcgi to Go Unix Socket FastCGI
require 'net/http' require 'net/https'
require 'uri'
class AppleReceiptVerifier
### Verifies Apple receipt submitted by iPhone
### See http://developer.apple.com/iphone/library/documentation/NetworkingInternet/Conceptual/StoreKitGuide/Overview%20of%20the%20Store%20Kit%20API/OverviewoftheStoreKitAPI.html#//apple_ref/doc/uid/TP40008267-CH100-SW14
def self.verify(b64_receipt)
url = URI.parse(APPLE_RECEIPT_VERIFY_URL)
http = Net::HTTP.new(url.host, url.port)
#!/usr/bin/env ruby
#/ Usage: <progname> [options]...
#/ How does this script make my life easier?
# ** Tip: use #/ lines to define the --help usage message.
$stderr.sync = true
require 'optparse'
# default options
flag = false
option = "default value"
Install and configure JAVA + MAVEN in Ubuntu 14.04
It's pretty easy to install and configure JAVA + MAVEN in Ubuntu 14.04 following these steps:
1. Install OpenJDK 7:
$ sudo apt-get install icedtea-7-plugin openjdk-7-jre openjdk-7-jdk
Check the installed java:
$ java -version
@sharmaansh21
sharmaansh21 / Makefile
Last active August 29, 2015 14:17 — forked from border/Makefile
include $(GOROOT)/src/Make.inc
GOFMT=gofmt -spaces=true -tabindent=false -tabwidth=4
all:
$(GC) jsontest.go
$(LD) -o jsontest.out jsontest.$O
format:
$(GOFMT) -w jsontest.go