Skip to content

Instantly share code, notes, and snippets.

View lamchakchan's full-sized avatar

Lam Chan lamchakchan

View GitHub Profile
@lamchakchan
lamchakchan / SqlMapper.cs
Created December 23, 2011 16:44
Modfiied Dapper For Glimpse Plugin, Plugin included.
/*
License: http://www.apache.org/licenses/LICENSE-2.0
Home page: http://www.codelyfe.com/Blog/Entry/View/3/
Note: to build on C# 3.0 + .NET 3.5, include the CSHARP30 compiler symbol (and yes,
I know the difference between language and runtime versions; this is a compromise).
*/
using System;
using System.Collections;
using System.Collections.Generic;
@lamchakchan
lamchakchan / elasticsearch-upgrade-to-1.5.sh
Last active February 20, 2017 02:40
Elasticsearch Upgrade Script for 1.5 For AWS
#!/bin/sh
#turn off relocation
curl -XPUT localhost:9200/_cluster/settings -d '{"transient":{"cluster.routing.allocation.enable": "none"}}'
#update the version number in the package file to point to a new target
echo "deb http://packages.elasticsearch.org/elasticsearch/1.5/debian stable main" > /etc/apt/sources.list.d/elasticsearch.list
#get the public key and add it to apt
wget -qO - http://packages.elasticsearch.org/GPG-KEY-elasticsearch | sudo apt-key add -
#shutdown the node
service elasticsearch stop
#install the update, make sure not to replace the elasticsearch.yml with one from package or custom settings will be lost
var Promise = require("bluebird"),
AWS = require("aws-sdk"),
Memcached = require("memcached"),
Joi = require("joi"),
Util = require("./modules/util.js"),
_ = require("lodash");
var PromiseSqs = function(options){
var internals = {
options : {
@lamchakchan
lamchakchan / gist:aac7089dfc3daab3ce59
Created April 14, 2015 17:17
Elasticsearch Rolling Restart
#!/bin/bash
#
# perform a rolling restart of all data/master nodes in a stable cluster
#
# args: [elasticsearch-host:port]
#
set -e
set -u
@lamchakchan
lamchakchan / gist:0e0fd87ce57b8ce5574c
Created April 15, 2015 16:59
Install Elasticsearch Curator and set crontab
#!/bin/sh
#install the curator cli
pip install elasticsearch-curator
#output the existing crontab
crontab -l > crontab.bak
echo "16 1 * * * /usr/local/bin/curator --host 127.0.0.1 delete indices --older-than 4 --time-unit days --prefix .marvel- --timestring '\%Y.\%m.\%d'" >> crontab.bak
crontab crontab.bak
rm crontab.bak
#!/bin/sh
export PATH=/usr/local/bin:$PATH
files=$(git diff --cached --name-only --diff-filter=ACM | grep ".js$")
pass=true
if [ "$files" = "" ]; then
exit 0
fi
name,version,environment
service-app-auth,1.4.1,qa
service-bi-api,0.0.1,qa
service-conversation-api,14.10.1,qa
service-conversation-bride-indexer,2.8.7,qa
service-conversation-indexer,5.6.1,qa
service-conversation-mail-api,4.0.2,qa
service-conversation-planner-api,17.12.1,qa
service-conversation-theknot-api,18.12.1,qa
service-conversation-vendor-indexer,2.8.7,qa
name,version
xo-ds-handler,4.3.0
xo-request,2.4.1
xo-rabbit,6.8.0
xo-logger,0.4.6
xo-error,1.0.4
host,path,protocol
qa-no-services.theknot.com,/local-partners/api/identity/identities/search,https
geo-api.xogrp.com,/geo/locations/market/%s,http
qa-no-services.theknot.com,/local-partners/tkpintegration/createtoken/%s,https
qa-no-services.theknot.com,/local-partners/api/identity/identities/search,https
qa-no-services.theknot.com,/local-partners/api/conversation/conversations/message,https
qa-no-services.theknot.com,/local-partners/api/conversation-theknot/conversations/message,https
qa-no-services.theknot.com,/local-partners/api/conversation-theknot/conversations/message,https
qa-no-services.theknot.com,/local-partners/api/identity/identities/search,https
qa-no-services.theknot.com,/local-partners/api/conversation/conversations/messages/,https
const Promise = require('bluebird');
const request = require('superagent');
const getXYZandABCResults = function() {
const self = this;
const task1 = request.get('http://www.xyz.com');
const task2 = request.get('http://www.abc.com');