Skip to content

Instantly share code, notes, and snippets.

View qcam's full-sized avatar

Cẩm Huỳnh qcam

View GitHub Profile
@qcam
qcam / jekyll_installation.md
Created July 5, 2014 09:03
Jekyll Installation

##Jekyll Installation

  1. Make a new directory for your blog
mkdir my-awesome-blog
cd my-awesome-blog
  1. Create your .ruby-gemset and .ruby-version
git credential-osxkeychain erase
host=github.com
protocol=https
@qcam
qcam / hardcore-rpc.md
Last active August 30, 2016 00:53
[HARDCORE] RPC.md

What's RPC?

In distributed computing, a remote procedure call (RPC) is when a computer program causes a procedure (this is what it differs from REST) to execute in another address space (commonly on another computer on a shared network), which is coded as if it were a normal (local) procedure call, without the programmer explicitly coding the details for the remote interaction.

There are multiple implementation of RPC: ONC RPC, JSON-RPC, XML-RPC, gRPC, SOAP, etc.

How RPC works?

  1. The client calls the client stub. The call is a local procedure call, with parameters pushed on to the stack in the normal way.
  2. The client stub packs the parameters into a message and makes a system call to send the message. Packing the parameters is called marshalling.
@qcam
qcam / hardcore-grpc.md
Last active August 30, 2016 00:57
[HARDCORE] gRPC

What's gRPC?

In gRPC a client application can directly call methods on a server application on a different machine as if it was a local object, making it easier for you to create distributed applications and services. As in many RPC systems, gRPC is based around the idea of defining a service, specifying the methods that can be called remotely with their parameters and return types. On the server side, the server implements this interface and runs a gRPC server to handle client calls. On the client side, the client has a stub (referred to as just a client in some languages) that provides the same methods as the server.

gRPC clients and servers can communicate no matter what programming languages they're written in. For instance, you can easily create gRPC servers in C++ and clients in Ruby/Python.

Transport and Semantics

gRPC uses (Protocol Buffers, aka. Protobuf)(https://github.com/google/protobuf), for data serialization.

@qcam
qcam / hardcore-funcprog.md
Last active October 16, 2016 03:58
My note for Functional Programming Principles in Scala course on Coursera - https://www.coursera.org/learn/progfun1/

Functional Programming

Week 1

Programming Paradigms

Main programming paradigms include:

Imperative Programming
@qcam
qcam / hub
Last active January 25, 2017 16:01
Sample config file for hub
# Place your file in ~/.config/hub
github.com:
- user: huynhquancam
oauth_token: XXX # personal token can be obtained from your Github > Settings > Security > Personal Token

Keybase proof

I hereby claim:

  • I am qcam on github.
  • I am qcam (https://keybase.io/qcam) on keybase.
  • I have a public key whose fingerprint is 7EAD EE10 DB51 9180 986A 30B4 1BE7 CEA2 28E5 28A9

To claim this, I am signing this object:

@qcam
qcam / sample.xml
Last active March 20, 2018 06:42
Benchmarking XML parser in Erlang/Elixir
<?xml version="1.0" encoding="UTF-8"?>
<breakfast_menu>
<food>
<name>Belgian Waffles</name>
<price>$5.95</price>
<description>Two of our famous Belgian Waffles with plenty of real maple syrup</description>
<calories>650</calories>
</food>
<food>
<name>Strawberry Belgian Waffles</name>
@qcam
qcam / time-extension-msgpack.rb
Created May 20, 2019 09:03
MessagePack Time extension unpacker in Ruby
require "msgpack"
class DateTimeExtension
def self.unpack(data)
case data.size
when 4
seconds = data.unpack("N")[0]
Time.at(seconds).utc
when 8
@qcam
qcam / font-asset-rails-heroku.md
Created May 3, 2014 00:20
[Rails Assets Pipeline] How to make web fonts work on Heroku

How to make web fonts work on Heroku

Add the fonts path to your production.rb and development.rb

# Add the font path
config.assets.paths << Rails.root.join('app', 'assets', 'fonts')

# Include font files to Assets
config.assets.precompile &lt;&lt; /\.(?:svg|eot|woff|ttf)$/