Skip to content

Instantly share code, notes, and snippets.

View garyelephant's full-sized avatar

Gary Gao garyelephant

View GitHub Profile
@garyelephant
garyelephant / upload.go
Created December 11, 2016 11:51 — forked from ebraminio/upload.go
golang upload client and server
// curl -X POST -H "Content-Type: application/octet-stream" --data-binary '@filename' http://127.0.0.1:5050/upload
package main
import (
"fmt"
"io"
"net/http"
"os"
"time"
@garyelephant
garyelephant / vim74centos
Created July 9, 2016 10:31 — forked from juxtin/vim74centos
Compile Vim 7.4 on Centos and install my vimrc
#!/bin/bash
yum groupinstall 'Development tools' -y
yum install ncurses ncurses-devel wget git -y
cd /usr/local/src
wget ftp://ftp.vim.org/pub/vim/unix/vim-7.4.tar.bz2
tar -xjf vim-7.4.tar.bz2
cd vim74
./configure --prefix=/usr --with-features=huge --enable-rubyinterp --enable-pythoninterp
make && make install
@garyelephant
garyelephant / Celery-SharedScheduler
Last active August 29, 2015 14:11
This scheduler is created to solve beat single point of failure problem by replacing celery default scheduler.Lock is implemented by Redis.
class SharedScheduler(Scheduler):
def __init__(self, *args, **kwargs):
Scheduler.__init__(self, *args, **kwargs)
self.merge_inplace(self.app.conf.CELERYBEAT_SCHEDULE)
# a redis server
self.redis = service.use_redis()
self.protocal = pickle
@garyelephant
garyelephant / Celery-Schedulers.py
Last active August 29, 2015 14:11 — forked from brolewis/schedulers.py
This scheduler is created to solve beat single point of failure problem by replacing celery default scheduler.Lock is implemented by Zookeeper.
'''Zookeeper-based Scheduler'''
## Standard Library
import cPickle # Store dictionary in ZooKeeper
import datetime # Time delta
import socket # Hostname
## Third Party
import celery # Current app
import celery.beat # Scheduler
import celery.utils.log # Get logger
import kazoo.client # ZooKeeper Client Library
#!/bin/bash
# Created Fri Mar 22 2014
# This is an indirect fork of https://gist.github.com/SeonghoonKim/4378896
# Most of it was reworked from http://blog.basefarm.com/blog/how-to-install-logstash-with-kibana-interface-on-rhel/
# This script will download, install and start
# the following items on CentOS 6.5:
# OpenJDK 1.7.0
# cURL
# ElasticSearch 1.0.1
# Logstash server 1.4.0

Sublime Text 2 – Useful Shortcuts (PC)

Loosely ordered with the commands I use most towards the top. Sublime also offer full documentation.

Editing

Ctrl+C copy current line (if no selection)
Ctrl+X cut current line (if no selection)
Ctrl+⇧+K delete line
Ctrl+↩ insert line after