- People talk about two servers: a web server (e.g. Nginx, Apache, etc.) and a app server (e.g. Language specific servers like Unicorn, Node.js, Tomcat, Http-Kit, etc.). There are exceptions where app servers not required at all (as web server itself provides preprocessors for handling), but let's not talk about now.
- Web servers are really fast and supports lot of standard and commonly used MIME-type requests. Concept of serving a file is -- forming and sending a response of bytes of data and labeling it with requested MIME-type by a client (e.g. web browser).
- Every response format (in layman's language, a file) is recognized by it's MIME-type, for e.g. a PNG image file has "image/png" MIME-type. JavaScript file has "text/javascript". HTML responses (or files) has "text/html". Plain text files have "text/plain".
- Modern Browsers supports a lot of standard MIME-types. Images, videos, text files (XML, HTML, SVG, JS), and they better know how to visualize it. Browser also knows unrec
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
ERROR | |
======= | |
$ gem install pg -v '0.17.0' | |
Building native extensions. This could take a while... | |
ERROR: Error installing pg: | |
ERROR: Failed to build gem native extension. | |
/home/vishal/.rvm/rubies/ruby-1.9.3-p194/bin/ruby extconf.rb | |
checking for pg_config... yes |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# aria2c must be installed before moving on | |
sudo curl https://yt-dl.org/downloads/2014.04.04.2/youtube-dl -o /usr/local/bin/youtube-dl | |
sudo chmod a+x /usr/local/bin/youtube-dl | |
sudo curl https://raw.githubusercontent.com/tobbez/youtube-dl-aria/master/youtube-dl-aria -o /usr/local/bin/youtube-dl-aria | |
sudo chmod a+x /usr/local/bin/youtube-dl-aria | |
# Usage: | |
youtube-dl-aria --get-filename -o "%(title)s.%(ext)s" OWHJa0jKJgo | |
# ^ | |
# | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Instructions | |
// | |
// 1. Open the spreadsheet that you want to backup in Google Drive. | |
// 2. Go to Extensions -> Apps Script. | |
// 3. Copy and paste the code below into the editor. Change "Untitled" script name | |
// to something meaningful | |
// 4. Save and run the script. You will have to authorize access. | |
// 5. Go to the spreadsheet's parent folder in Google Drive. | |
// 6. Make sure that the backup folder and the year folder have been created. | |
// 7. Go to the year folder and make sure that the backup file has been created. |
- z - Easily jump around
- tmux - Sessions, windows, panes, whoa! (key-bindings)
- On a remote server,
tmux -CC [attach]
mode from iTerm2. More details here.
- On a remote server,
- https://asciinema.org - Record and share terminal sessions as video (very lightweight!)
- FiraCode Nerd Font (previously used FiraCode, mononoki and Consolas)
- fzf - Fuzzy reverse search (using Ctrl-R)
- nvim with Nvchad
- gifgen - video to GIF converter
- Create
/etc/logrotate.d/my-crazy-app
file with following snippet:
/var/log/my-crazy-app/*.log {
daily
size 500M
missingok
rotate 10
compress
delaycompress
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// recieve message | |
// event object contains: | |
// - data: message sent | |
// - origin (host from which the message was sent, e.g. http://blah.example.com) | |
// - source (reference to a Window object from which message was sent) | |
function postMessageHandler( event ) { | |
console.log("We've got a message!"); | |
console.log("* Message:", event.data); | |
console.log("* Origin:", event.origin); | |
console.log("* Source:", event.source); |
$ mdfind 'kMDItemFSSize > 200000000' | sed 's| |\\ |g' | xargs du -sch
# ^
# ~ 200MiB
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# In Java, the following expression | |
# Integer.toHexString(1286933134) | |
# produces: | |
# "4cb50a8e" | |
# and | |
# Integer.toHexString(-1286933134) | |
# produces: | |
# "b34af572" | |
# ref doc: http://docs.oracle.com/javase/7/docs/api/java/lang/Integer.html#toHexString(int) |
-
To install packages, every time pressing '
ctrl+shift+p
→Package Control: Install Package
is very cumbersome task... right? -
After fresh installation of ST2, open it and
ctrl+`
and hit enter after pasting below line [(1)][1]:
import urllib2,os; pf='Package Control.sublime-package'; ipp=sublime.installed_packages_path(); os.makedirs(ipp) if not os.path.exists(ipp) else None; urllib2.install_opener(urllib2.build_opener(urllib2.ProxyHandler())); open(os.path.join(ipp,pf),'wb').write(urllib2.urlopen('http://sublime.wbond.net/'+pf.replace(' ','%20')).read()); print('Please restart Sublime Text to finish installation')
-
Restart ST2.
-
Open terminal, and navigate to Sublime's dir under your home folder by below command and create file w/ name
Package Control.sublime-settings
there in:
NewerOlder