Skip to content

Instantly share code, notes, and snippets.

View irvinlim's full-sized avatar

Irvin Lim irvinlim

  • Singapore
  • 13:12 (UTC +08:00)
View GitHub Profile
import grpc
from consistent_storage.pb.consistent_storage_pb2 import *
from consistent_storage.pb.consistent_storage_pb2_grpc import ConsistentStorageServicer
from lib.consistent_storage import BaseStorageBackend
class GrpcProxyServer(ConsistentStorageServicer):
"""
Consistent storage proxy server that exposes a gRPC interface.
@irvinlim
irvinlim / pre-commit.sh
Created June 28, 2018 08:50
Git pre-commit hook for Pylint
#!/bin/bash
##
## Pylint Git Pre-commit Hook
##
## Supports linting only staged files, or otherwise defaults to all changed files.
## Add this script in `.git/hooks/pre-commit`.
staged=`git diff --name-only --cached --diff-filter=A --diff-filter=M | cat`
pylint=".venv/bin/pylint --rcfile .pylintrc --load-plugins pylint_django --load-plugins pylint_quotes --reports=no"

Keybase proof

I hereby claim:

  • I am irvinlim on github.
  • I am irvinlim (https://keybase.io/irvinlim) on keybase.
  • I have a public key ASBAxNGdeBi2NqSt4597etOamOw5Sia9tL4b0j1iFdiINQo

To claim this, I am signing this object:

@irvinlim
irvinlim / map_obj.js
Last active July 24, 2016 09:14
Similar to Array.prototype.map, these methods run a function on every object property or object key.
// Inspired from http://stackoverflow.com/a/14810722/2037090
/**
* Maps object keys using a given function.
* @param {Object} obj Target object
* @param {Function} fn Mapping function that takes in an object key, and returns a new object key.
* Method signature:
* function(key: string) => newKey: string
* @return {Object} Newly constructed object with mapped keys. Original object is not modified.
*/