Skip to content

Instantly share code, notes, and snippets.

#! /bin/sh
### BEGIN INIT INFO
# Provides: redis-server
# Required-Start: $syslog
# Required-Stop: $syslog
# Should-Start: $local_fs
# Should-Stop: $local_fs
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: redis-server - Persistent key-value db
@observerss
observerss / etc-init-elasticsearch.conf
Last active December 19, 2015 19:19 — forked from jaytaylor/etc-init-elasticsearch.conf
elasticsearch upstart script for official deb packages (tested with 0.90.2)
# ElasticSearch Service
description "ElasticSearch"
start on (net-device-up
and local-filesystems
and runlevel [2345])
stop on runlevel [016]
respawn
/*
Pretty Date script modified from John Resig here http://ejohn.org/blog/javascript-pretty-date
*/
function relativeDateTime (tdate) {
var system_date;
if (typeof (tdate) === "number") {
tdate = new Date(tdate).toString();
}
if (navigator.userAgent.match(/MSIE\s([^;]*)/)) {
@observerss
observerss / gist:4142775
Created November 25, 2012 07:56
My Favorite Bash Prompt
PS1="\[\033[01;32m\]\u\[\033[00m\] \[\033[01;34m\]\w\[\033[01;31m\]\`git branch 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/(git:\1)/'\`\[\033[00m\]\$ "
@observerss
observerss / setup.sh
Created October 10, 2012 09:04
ubuntu initialize script
#!/bin/sh
apt-get update
apt-get -y upgrade
apt-get -y install build-essential python-dev libevent-dev libxslt-dev uuid-dev python-setuptools dtach libzmq-dev
apt-get -y install sysstat vnstat redis-server mysql-server
easy_install pip
pip install virtualenvwrapper
pip install cython
pip install zerorpc lxml requests pymongo mongoengine redis redisco fabric ipython sqlalchemy bottle django flask
@observerss
observerss / s3put
Created October 9, 2012 09:38 — forked from mattbillenstein/s3put
boto parallel s3 upload script
#!/usr/bin/env python
import gevent.monkey
gevent.monkey.patch_all()
import boto
import config
import gevent
import gevent.pool
import os
@observerss
observerss / gist:3786658
Created September 26, 2012 07:51 — forked from padolsey/gist:527683
JavaScript: Detect IE
// ----------------------------------------------------------
// A short snippet for detecting versions of IE in JavaScript
// without resorting to user-agent sniffing
// ----------------------------------------------------------
// If you're not in IE (or IE version is less than 5) then:
// ie === undefined
// If you're in IE (>=5) then you can determine which version:
// ie === 7; // IE7
// Thus, to detect IE:
// if (ie) {}
@observerss
observerss / AioPool.md
Last active August 29, 2015 14:16
Gevent pool/group alike in python3 asyncio

Gevent Pool/Group Alike in Python3 Asyncio

Python3 Asyncio implements an event loop, but in quite low level, it's missing some basic helpers that can make your life a lot easier.

The Pool and Group are typical missing ones. Compare these codes below

Simple Loop

  • without group
{
"metadata": {
"name": "",
"signature": "sha256:f7fc0e66200bb5a9cae8e5e59abfaa99691caa881252e9266f11e7cffc7dafe6"
},
"nbformat": 3,
"nbformat_minor": 0,
"worksheets": [
{
"cells": [