Skip to content

Instantly share code, notes, and snippets.


Viet vietlq

  • United Kingdom
View GitHub Profile
vietlq /
Created May 14, 2012 — forked from kirpit/
Enables to run subprocess commands in a different thread with TIMEOUT option!
class Command(object):
Enables to run subprocess commands in a different thread
with TIMEOUT option!
Based on jcollado's solution:
def __init__(self, cmd):
self.cmd = cmd
View gist:5227020
# The latest version of this script is now available at
brew update
brew install rbenv ruby-build rbenv-vars readline ctags
if [ -n "${ZSH_VERSION:-}" ]; then
echo 'eval "$(rbenv init - --no-rehash)"' >> ~/.zshrc
echo 'eval "$(rbenv init - --no-rehash)"' >> ~/.bash_profile

Build a scalable Twitter clone with Django and

In this tutorial we are going to build a Twitter clone using Django and, a hosted API for newsfeed development. We will show you how easy is to power your newsfeeds with At the end of this tutorial we will have a Django app with a profile feed, a timeline feed, support for following users, hashtags and mentions.

I assume that you are familiar with Django. If you're new to Django the [official tutorial] ( explains it very well.

Bootstrap the Django application

vietlq / How to build a notification
Created Oct 4, 2015 — forked from tbarbugli/How to build a notification
How to build a notification feed using Stream
View How to build a notification

How to build a notification feed using Stream


In this tutorial we are going to show how easy it is to build a notification feed using First of all, let's quickly introduce you to our fictional example app. It's called and allows you interact with your friends, ping them, follow them or poke them. Here's a quick list of example interactions:

  • poke another user (eg. Thierry pokes Alessandra)
  • follow a user (eg. Tommaso follows Iris)
  • ping a user (eg. Josie pings Carolina)

Whenever a user is part of one of these interactions, we want to update his notification feed, update the number of unseen and unread

import os
from fabric.api import env, require, run, sudo, cd
env.project_name = ''
env.server_name = ''
env.webapps_root = '/opt/webapps/'
env.project_root = os.path.join(env.webapps_root, env.project_name)
env.activate_script = os.path.join(env.project_root, 'env/bin/activate')
env.wsgi_file = os.path.join(env.project_root, 'django.wsgi')

Keybase proof

I hereby claim:

  • I am vietlq on github.
  • I am vietlq ( on keybase.
  • I have a public key whose fingerprint is E6C9 B812 DD28 F53F DC23 496E 662E 0FF5 B2DB 6E92

To claim this, I am signing this object:

vietlq /
Created Sep 3, 2016 — forked from olasd/
Stream video to youtube via ffmpeg
#! /bin/bash
# Diffusion youtube avec ffmpeg
# Configurer youtube avec une résolution 720p. La vidéo n'est pas scalée.
VBR="2500k" # Bitrate de la vidéo en sortie
FPS="30" # FPS de la vidéo en sortie
QUAL="medium" # Preset de qualité FFMPEG
YOUTUBE_URL="rtmp://" # URL de base RTMP youtube
View sw.js
toolbox.options.debug = false;
//FOr homepage, we use fastest so that it update new content for next request
toolbox.router.get('/', toolbox.fastest);
// The route for the images
vietlq /
Created Sep 16, 2016 — forked from dpapathanasiou/
How to use SchemaSpy to generate the db schema diagram for a PostgreSQL database

SchemaSpy is a neat tool to produce visual diagrams for most relational databases.

Here's how to use it to generate schema relationship diagrams for PostgreSQL databases:

  1. Download the jar file from here (the current version is schemaSpy_5.0.0.jar)

  2. Get the PostgreSQL JDBC driver (either the JDBC3 or JDBC4 jar file is fine)

  3. Run the command against an existing database. For most databases, the schema (-s option) we are interested in is the public one:

vietlq / kernel.js
Created Sep 22, 2016 — forked from Carreau/kernel.js
A node.js kernel for IPython notebook. You can see the explanation of the ipynb rendered in
View kernel.js
zmq = require("zmq")
fs = require("fs")
var config = JSON.parse(fs.readFileSync(process.argv[2]))
var connexion = "tcp://"+config.ip+":"
var shell_conn = connexion+config.shell_port
var pub_conn = connexion+config.iopub_port
var hb_conn = connexion+config.hb_port
You can’t perform that action at this time.