Skip to content

Instantly share code, notes, and snippets.

View .emacs.configs.el
;; PDF
(add-to-list 'auto-mode-alist '("\\.pdf\\'" . pdf-view-mode))
(setq pdf-annot-activate-created-annotations t)
(add-hook 'pdf-view-mode-hook (lambda()
(linum-mode -1)
(pdf-view-midnight-minor-mode 1)
(evil-local-mode -1)
(setq bookmark-default-file (concat (file-name-directory (directory-file-name (file-name-directory (buffer-file-name)))) "bookmark"))
View Looking into the

Looking into the Future

futures-rs is the library which will hopefully become a shared foundation for everything async in Rust. However it's already become renowned for having a steep learning curve, even for experienced Rustaceans.

I think one of the best ways to get comfortable with using a library is to look at how it works internally: often API design can seem bizarre or impenetrable and it's only when you put yourself in the shoes of the library author that you can really understand why it was designed that way.

In this post I'll try to put down on "paper" my understanding of how futures work and I'll aim to do it in a visual way. I'm going to assume you're already somewhat familiar with Rust and why futures are a useful tool to have at one's disposal.

For most of this post I'll be talking about how things work today (as of September 2017). At the end I'll touch on what's being proposed next and also make a case for some of the changes I'd like to see.

If you're interested in learning more ab

pesterhazy /
Last active Apr 20, 2022
Using ripgrep in Emacs using helm-ag (Spacemacs)


Ripgrep is a fast search tool like grep. It's mostly a drop-in replacement for ag, also know as the Silver Searcher.

helm-ag is a fantastic package for Emacs that allows you to display search results in a buffer. You can also jump to locations of matches. Despite the name, helm-ag works with ripgrep (rg) as well as with ag.


qcam /
Last active Aug 30, 2016

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.
huydx / simple_regex.go
Last active Aug 30, 2016
View simple_regex.go
package main
import (
func match(regex string, text string) bool {
if string(regex[0]) == "^" {
return matchhere(regex[1:], text)
huytd / co-in-15-lines.js
Last active May 25, 2016
Re-implement tj/co in 15 lines
View co-in-15-lines.js
function run(fn) {
var pointer = fn();
var next = function(result) {
if (result.value.then && typeof result.value.then === 'function') {
result.value.then(function(data) {
var out =;
if (!out.done) next(out);
} else {
var out =;
adham90 / spacemacs-keybindings
Last active Sep 12, 2022
spacemacs keybindings that i need to learn
View spacemacs-keybindings
SPC s c remove highlight
**** Files manipulations key bindings
Files manipulation commands (start with ~f~):
| Key Binding | Description |
| ~SPC f c~ | copy current file to a different location |
| ~SPC f C d~ | convert file from unix to dos encoding |
| ~SPC f C u~ | convert file from dos to unix encoding |
gaearon / slim-redux.js
Last active Sep 12, 2022
Redux without the sanity checks in a single file. Don't use this, use normal Redux. :-)
View slim-redux.js
function mapValues(obj, fn) {
return Object.keys(obj).reduce((result, key) => {
result[key] = fn(obj[key], key);
return result;
}, {});
function pick(obj, fn) {
return Object.keys(obj).reduce((result, key) => {
if (fn(obj[key])) {
# pulled from
# expanded via
# tested with on OSX Mavericks
# OSX terminal
brew install qemu
# kernel-qemu is a linux kernel compiled with ARM1176 support.
# learn more here:
curl -OL
curl -o -L
lukehedger / ffmpeg-compress-mp4
Last active Sep 24, 2022
Compress mp4 using FFMPEG
View ffmpeg-compress-mp4
$ ffmpeg -i input.mp4 -vcodec h264 -acodec mp2 output.mp4