As configured in my dotfiles.
start new:
tmux
start new with session name:
| #include <stdio.h> | |
| #include <stdlib.h> | |
| #include <string.h> | |
| #include <errno.h> | |
| #include <unistd.h> | |
| #include <fcntl.h> | |
| /**************************************************************** | |
| * Constants | |
| ****************************************************************/ |
| *note: depends=('imagemagick' 'libxv' 'python2' 'gtk2' 'qt4' 'pygtk' 'v4l-utils') (apply for archlinux, use proper package with other distro. Something linke libv4l-devel alter v4l-utils) | |
| get package: | |
| wget http://downloads.sourceforge.net/project/zbar/zbar/0.10/zbar-0.10.tar.bz2 | |
| tar xvf zbar-0.10.tar.bz2 | |
| cd zbar-0.10 | |
| put v4l1.path to the zbar-0.10 directory too | |
| patch -p1 < v4l1.patch | |
| ./configure --prefix=/usr --without-qt --without-gtk --without-python --without-java CFLAGS=-DNDEBUG |
| from SimpleCV import Color, Camera, Display | |
| cam = Camera() | |
| display = Display() | |
| message = 'Last item scanned: ' | |
| result = 'None' | |
| while (display.isNotDone()): | |
| img = cam.getImage() |
| ! Zvnrt | |
| *cursor: #c6c6c6 | |
| *foreground: #d6d6d6 | |
| *foreground_bold: #d6d6d6 | |
| *background: #141414 | |
| *color0: #303030 | |
| *color1: #666666 | |
| *color2: #404040 |
| from subprocess import Popen, PIPE | |
| from time import sleep | |
| # run the shell as a subprocess: | |
| p = Popen(['python', 'shell.py'], | |
| stdin = PIPE, stdout = PIPE, stderr = PIPE, shell = False) | |
| # issue command: | |
| p.stdin.write('command\n') | |
| # let the shell output the result: | |
| sleep(0.1) |
| Okay so here's the setup: | |
| [-] The primary server API is exposed via Flask (Python) and all static files, including all html, css, js is served by nginx. | |
| [-] Python is exposing an API at url http://domain.com/api/download/<file_id>, where file_id is a database id for the file that we're interested in downloading. | |
| 1. User wants to download a file, so we spawn a new window with the url '/api/download/<file_id>' | |
| 2. Nginx intercepts the request, sees that it starts with /api/, and then forwards the request to Flask, which is being served on port 5000. | |
| 3. Flask routes the request to its download method, retrieves the pertinent data from the file_id, and constructs additional header settings to make nginx happy and to force the browser to see the file stream as a download request instead of the browser just trying to open the file in a new window. Flask then returns the modified header stream to nginx | |
| 4. Nginx is finally ready to do some work. While parsing the headers for the incoming request, it encounters "X |
| $(".dropdown-menu li a").click(function(){ | |
| var selText = $(this).text(); | |
| $(this).parents('.btn-group').find('.dropdown-toggle').html(selText+' <span class="caret"></span>'); | |
| }); | |
| $("#btnSearch").click(function(){ | |
| alert($('.btn-select').text()+", "+$('.btn-select2').text()); | |
| }); |
| javascript: (function() { var subs = []; var base = "http://subscene.com"; var find = "http://subscene.com/subtitles/title?q="; var langs = ['vietnamese', 'english']; var url; var rq = prompt("input: ", "name"); var xhr = new XMLHttpRequest(); var parser = new DOMParser(); xhr.open("GET", find + rq.split(" ").join("+") + "&l=", false); xhr.send(); var rPage = parser.parseFromString(xhr.response, "text/html"); var result = (rPage.getElementsByClassName("search-result")[0]).getElementsByTagName("h2")[0].innerHTML; if (result == "No results found") { return "no results"; } else { var lsFilm = (rPage.getElementsByClassName("search-result")[0]).getElementsByTagName("li"); var lsFilm_2 = []; for (var f = 0; f < lsFilm.length; f++) { lsFilm_2[f] = f + ". " + lsFilm[f].getElementsByTagName("a")[0].innerHTML; } alert(lsFilm_2.join("\n")); var choice = prompt("your choice: ", "0"); if |
| ## Hallo | |
| My name is Doan Luong Van and I am currently a back-end developer at FPT Telecom. | |
| I am just a lazy and simple man who is a readaholic, a cyclist and a backpacker. I am interested in taking photo (photography enthusiast, maybe), making funny things (robot, paper models, etc...), backpacking and enjoying my life every moment. | |
| Volunteering is an important part of my life. Sharing is happiness. | |
| I always keep in mind the following quote. | |
| "Keep it simple, stupid" | |
As configured in my dotfiles.
start new:
tmux
start new with session name: