Magic words:
psql -U postgresIf run with -E flag, it will describe the underlaying queries of the \ commands (cool for learning!).
Most \d commands support additional param of __schema__.name__ and accept wildcards like *.*
| " enable plugins | |
| filetype on | |
| syntax enable | |
| " basic settings | |
| set laststatus=2 " Always show the statusline | |
| "set term=$TERM | |
| set encoding=utf-8 " Necessary to show unicode glyphs | |
| " if $TERM!="linux" " if we are not in tty | |
| " set t_Co=256 " Tell that terminal supports 256 colors |
| <html> | |
| <head> | |
| <style> | |
| tr { | |
| page-break-inside: auto !important; | |
| } | |
| </style> | |
| </head> |
| BEGIN:VCALENDAR | |
| PRODID:-//Google Inc//Google Calendar 70.9054//EN | |
| VERSION:2.0 | |
| CALSCALE:GREGORIAN | |
| METHOD:PUBLISH | |
| X-WR-CALNAME:Public Holidays 2016 | |
| X-WR-TIMEZONE:Asia/Singapore | |
| X-WR-CALDESC: | |
| BEGIN:VEVENT | |
| DTSTART;VALUE=DATE:20161226 |
As configured in my dotfiles.
start new:
tmux
start new with session name:
| ## 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" | |
| 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 |
| $(".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()); | |
| }); |
| 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 |
| 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) |