Fix post styling

This commit is contained in:
Tyler Hallada 2014-07-24 13:00:30 -04:00
parent a90f0d369e
commit c45ce8f48b
5 changed files with 322 additions and 123 deletions

View File

@ -26,29 +26,41 @@ Since this is questionably legal, make sure you understand any Terms of
Services you accepted or laws in your locality regarding this before you follow Services you accepted or laws in your locality regarding this before you follow
the steps below ;). the steps below ;).
###Have Linux### Most of these instructions will assume you have Ubuntu, but ###Have Linux###
Most of these instructions will assume you have Ubuntu, but
most distributions will work. most distributions will work.
While RTMPDump works on a variety of operating systems, I've only researched While RTMPDump works on a variety of operating systems, I've only researched
how to do this on Linux. Feel free to comment if you know how to do this in how to do this on Linux. Feel free to comment if you know how to do this in
Windows or OSX. Windows or OSX.
###Install RTMPDump### This open source goodness can be found at ###Install RTMPDump###
This open source goodness can be found at
[http://rtmpdump.mplayerhq.hu/](http://rtmpdump.mplayerhq.hu/) or you can just [http://rtmpdump.mplayerhq.hu/](http://rtmpdump.mplayerhq.hu/) or you can just
intall it using your Linux distro's package manager. For Ubuntu, that would be intall it using your Linux distro's package manager. For Ubuntu, that would be
typing the following into your terminal: typing the following into your terminal:
sudo apt-get install rtmpdump ```bash
sudo apt-get install rtmpdump
```
###Redirect ALL the RTMP!### Now we need to configure your firewall to redirect ###Redirect ALL the RTMP!###
Now we need to configure your firewall to redirect
all RTMP traffic to a local port on your computer (Note: this will screw up any all RTMP traffic to a local port on your computer (Note: this will screw up any
RTMP streaming video you try to watch on your computer, so make sure you run RTMP streaming video you try to watch on your computer, so make sure you run
the undo command in one of the later steps to return things to normal). Type the undo command in one of the later steps to return things to normal). Type
the following into your terminal, there should be no output from the command: the following into your terminal, there should be no output from the command:
sudo iptables -t nat -A OUTPUT -p tcp --dport 1935 -j REDIRECT ```bash
sudo iptables -t nat -A OUTPUT -p tcp --dport 1935 -j REDIRECT
```
###Run rtmpsrv### When you install `rtmpdump`, a program called `rtmpsrv` ###Run rtmpsrv###
When you install `rtmpdump`, a program called `rtmpsrv`
should have been bundled with it and installed as well. We will want to run should have been bundled with it and installed as well. We will want to run
this now by entering the following command in a terminal: this now by entering the following command in a terminal:
@ -60,7 +72,9 @@ This should output something that looks like this:
Streaming on rtmp://0.0.0.0:1935 Streaming on rtmp://0.0.0.0:1935
###Feed rtmpsrv the Precious Video### Now go to your browser and open/refresh ###Feed rtmpsrv the Precious Video###
Now go to your browser and open/refresh
the page with the desired video. Try playing the video. If nothing happens and the page with the desired video. Try playing the video. If nothing happens and
it just continues to give you a black screen, then you're on the right track: it just continues to give you a black screen, then you're on the right track:
rtmpsrv has intercepted the video. rtmpsrv has intercepted the video.
@ -72,18 +86,26 @@ will need it later.
You can CTRL+C out of rtmpsrv now that we have what we need. You can CTRL+C out of rtmpsrv now that we have what we need.
###Undo the Redirection### You must undo the iptables redirection command we ###Undo the Redirection###
You must undo the iptables redirection command we
performed earlier before you can do anything else, so run this in your performed earlier before you can do anything else, so run this in your
terminal: terminal:
sudo iptables -t nat -D OUTPUT -p tcp --dport 1935 -j REDIRECT ```bash
sudo iptables -t nat -D OUTPUT -p tcp --dport 1935 -j REDIRECT
```
###Finally, Download the Precious Video### Now paste that command you copied ###Finally, Download the Precious Video###
Now paste that command you copied
from the rtmpsrv output in the step before last into your terminal prompt and from the rtmpsrv output in the step before last into your terminal prompt and
hit enter. You should now see a torrent of `INFO` printout along with a hit enter. You should now see a torrent of `INFO` printout along with a
percentage as the video is being downloaded. percentage as the video is being downloaded.
###Feast Eyes on Precious Video### Once downloaded, the video file, which has a ###Feast Eyes on Precious Video###
Once downloaded, the video file, which has a
`flv` extension and was named by the `-o` parameter in the command you copied `flv` extension and was named by the `-o` parameter in the command you copied
and pasted, should be in your current directory (`ls | grep flv` can find it as and pasted, should be in your current directory (`ls | grep flv` can find it as
well). Any video player should be able to play it, but vlc is a nice video well). Any video player should be able to play it, but vlc is a nice video

View File

@ -28,20 +28,21 @@ script wrapper around w3m that takes urls and replaces `"http://reddit.com"` and
w3m (as well as fixing a double forward slash error in the comment uri cortex w3m (as well as fixing a double forward slash error in the comment uri cortex
outputs that desktop reddit accepts but mobile reddit 404s on). The script: outputs that desktop reddit accepts but mobile reddit 404s on). The script:
#!/bin/bash ```bash
#!/bin/bash
args=() args=()
until [ -z "$1" ]; do until [ -z "$1" ]; do
case "$1" in case "$1" in
-t|--tmux) t=1; shift ;; -t|--tmux) t=1; shift ;;
--) shift ; break ;; --) shift ; break ;;
-*) echo "invalid option $1" 1>&2 ; shift ;; # or, error and exit 1 just like getopt does -*) echo "invalid option $1" 1>&2 ; shift ;; # or, error and exit 1 just like getopt does
*) args+=("$1") ; shift ;; *) args+=("$1") ; shift ;;
esac esac
done done
args+=("$@") args+=("$@")
for arg in "${args[@]}" ; do for arg in "${args[@]}" ; do
# Switch to mobile reddit # Switch to mobile reddit
url=${arg/http:\/\/reddit.com/http:\/\/m.reddit.com} url=${arg/http:\/\/reddit.com/http:\/\/m.reddit.com}
url=${url/http:\/\/www.reddit.com/http:\/\/m.reddit.com} url=${url/http:\/\/www.reddit.com/http:\/\/m.reddit.com}
@ -52,7 +53,8 @@ outputs that desktop reddit accepts but mobile reddit 404s on). The script:
else else
w3m "${url}" w3m "${url}"
fi fi
done done
```
Since I regurally use [Tmux](http://tmux.sourceforge.net/) (with Since I regurally use [Tmux](http://tmux.sourceforge.net/) (with
[Byobu](http://byobu.co/)), I also added an optional `-t`/`--tmux` switch that [Byobu](http://byobu.co/)), I also added an optional `-t`/`--tmux` switch that
@ -61,8 +63,10 @@ will open w3m in a temporary new tmux window that will close when w3m is closed.
I saved the script as `w3m-reddit` and made it an executable command. In Ubuntu I saved the script as `w3m-reddit` and made it an executable command. In Ubuntu
that's done with the following commands: that's done with the following commands:
$ sudo mv w3m-reddit /usr/bin/ ```bash
$ sudo chmod +x /usr/bin/w3m-reddit $ sudo mv w3m-reddit /usr/bin/
$ sudo chmod +x /usr/bin/w3m-reddit
```
Now cortex needs to be configured to use `w3m-reddit`, and that's done by Now cortex needs to be configured to use `w3m-reddit`, and that's done by
setting `browser-command` in the cortex config at `~/.cortex/config` to setting `browser-command` in the cortex config at `~/.cortex/config` to

View File

@ -52,37 +52,38 @@ This is how I got it setup (on any Ubuntu machine with sudo privileges):
Save the following python file in `/usr/bin/` as `search-pane` (no extension): Save the following python file in `/usr/bin/` as `search-pane` (no extension):
#!/usr/bin/python ```python
from subprocess import call, check_output #!/usr/bin/python
from threading import Thread from subprocess import call, check_output
import os from threading import Thread
import sys import os
import readline import sys
import readline
home = os.path.expanduser("~") home = os.path.expanduser("~")
histfile = os.path.join(home, ".search-pane/history") histfile = os.path.join(home, ".search-pane/history")
# load history # load history
readline.read_history_file(histfile) readline.read_history_file(histfile)
os.system('cls' if os.name=='nt' else 'clear') # clear the terminal os.system('cls' if os.name=='nt' else 'clear') # clear the terminal
url = '' url = ''
query = '' query = ''
if len(sys.argv) > 1: if len(sys.argv) > 1:
url = "http://google.com/search?q=" + '+'.join(sys.argv[1:]) # google url url = "http://google.com/search?q=" + '+'.join(sys.argv[1:]) # google url
query = ' '.join(sys.argv[1:]) query = ' '.join(sys.argv[1:])
readline.add_history(query) # add query to history buffer readline.add_history(query) # add query to history buffer
else: else:
try: try:
query = raw_input('Search: ') # get user's search query = raw_input('Search: ') # get user's search
url = "http://google.com/search?q=" + '+'.join(query.split()) # google url = "http://google.com/search?q=" + '+'.join(query.split()) # google
except KeyboardInterrupt: except KeyboardInterrupt:
sys.exit(0) sys.exit(0)
readline.write_history_file(histfile) # write search to history file readline.write_history_file(histfile) # write search to history file
def write_other_hosts(): def write_other_hosts():
# write to history files on other registered hosts # write to history files on other registered hosts
with open(os.devnull, 'w') as FNULL: with open(os.devnull, 'w') as FNULL:
with open(os.path.join(home, ".search-pane/other-hosts"), "r") as f: with open(os.path.join(home, ".search-pane/other-hosts"), "r") as f:
@ -96,28 +97,35 @@ Save the following python file in `/usr/bin/` as `search-pane` (no extension):
call(['ssh', host, 'echo', '"' + query + '"', '>>', path], call(['ssh', host, 'echo', '"' + query + '"', '>>', path],
stderr=FNULL) stderr=FNULL)
# Spin off another thread for sshing so user doesn't have to wait for # Spin off another thread for sshing so user doesn't have to wait for
# connection to complete before viewing w3m. # connection to complete before viewing w3m.
try: try:
Thread(target=write_other_hosts).start() Thread(target=write_other_hosts).start()
except Exception, errtxt: except Exception, errtxt:
print errtxt print errtxt
call(['w3m', url]) # pass url off to w3m call(['w3m', url]) # pass url off to w3m
```
Make the directory and file for search history: Make the directory and file for search history:
mkdir ~/.search-pane ```bash
touch ~/.search-pane/history mkdir ~/.search-pane
touch ~/.search-pane/history
```
Allow anyone to execute the python script (make it into a program): Allow anyone to execute the python script (make it into a program):
chmod a+x /usr/bin/search-pane ```bash
chmod a+x /usr/bin/search-pane
```
To get quick access to the program from the command-line edit `~/.bashrc` to To get quick access to the program from the command-line edit `~/.bashrc` to
add: add:
alias s='search-pane' ```bash
alias s='search-pane'
```
To add byobu key bindings edit `~/.byobu/keybindings.tmux` (or `/usr/share/byobu/keybindings/f-keys.tmux`): To add byobu key bindings edit `~/.byobu/keybindings.tmux` (or `/usr/share/byobu/keybindings/f-keys.tmux`):

View File

@ -3,45 +3,208 @@ title: On Chromebooks
layout: post layout: post
--- ---
I like to think that if only I find The Perfect Text Editor I will somehow Like a lot of people, I didnt see a clear use-case for Chromebooks. Theyre
write better and more often. Obviously this is only a tactic I use to delay just glorified browsers, right? What if I wanted to do anything outside of the
actually writing anything, but I did come across something that might actually browser? Why would you spend [$1299 or $1449 for a
help. [Draft](https://draftin.com) is a writing app being developed by one guy, computer](https://www.google.com/intl/en/chrome/devices/chromebooks.html#pixel)
[Nate Kontny](https://twitter.com/natekontny), that has a ton of nifty that can only run a browser?
features, one of its best being a version control system that allows you to
send a draft to other people and accept or reject any changes they suggest. It
also has a minamilistic iA Writer type interface, which focuses on the actual
writing and nothing more.
One of my most favorite features that I have just discovered, though, is that While I know a lot of people who buy expensive MacBooks only to just use a web
it allows publishing any Draft document to any arbitrary browser and iTunes, Im a bit more of a power user and I need things like
[WebHook](http://en.wikipedia.org/wiki/Webhook). Which basically means I can [Eclipse](http://www.eclipse.org/) (popular programming IDE) and
click a button in the interface and that will send a POST request to a URL I [Inkscape](http://inkscape.org/) (open source vector graphics editor). I
specify with all of the data for my Draft document in JSON format. I can just figured that if Id ever get a Chromebook, I would quickly ditch its crippled
write a bit of code to parse that data and then I instantly have a better ChromeOS for [Ubuntu](http://www.ubuntu.com/) instead, so I could use my
editor for my blog. favorite operating system on the quality Chromebook hardware. It turns out, a
lot of people do this. So many that there are a couple of Ubuntu forks that
have been developed that allow you to run both ChromeOS and Ubuntu on the same
Chromebook: [ChrUbuntu](http://chromeos-cr48.blogspot.fr/) and
[Crouton](https://github.com/dnschneid/crouton).
It was really easy to do too. For this Django website, all it took [was adding However, when I recently acquired a [Samsung
a view that parsed a JSON object and made a blog entry out of Chromebook](https://www.google.com/intl/en-US/chrome/devices/samsung-chromebook.html#ss-cb):
it](https://github.com/thallada/personalsite/commit/c4694a6669dbc7b79a5bff3fb818a682ecacffbb). Googles ARM processor Chromebook, I discovered what makes Chromebooks, and
You can read the even ChromeOS, so amazing. **I realized there is no need for anything more than
[documentation](https://draftin.com/documents/69898?token=5fjKKlZ0-AeBzqj_RAftAGdzRzl9VBfBHj5wpSWm_gU) Chrome**. Even for a power user like me.
for more info on how to make a WebHook for Draft.
Nate has also made a lot of other neat features, like a [Chrome extension that <a href="/static/img/full_chromebook.jpg"><img
turns any textarea on the web into a Draft src="/static/img/full_chromebook_thumb.jpg" alt="Samsung Chromebook open on a
document](https://chrome.google.com/webstore/detail/draft/amlbbbgcijmiooecobhkjblcdkjldmdk). porch"></a>
Read about some of the other features in the [Lifehacker
article](http://lifehacker.com/5993339/draft-is-a-writing-app-with-serious-version-and-draft-control).
The app is still in development and new features are being added constantly.
I think the take-away here is that the Big Guys, with apps like Google Drive or Before long, I had completely abandoned my old heavy [2011 Dell
Evernote, don't always have the best solutions. I tried hacking Google Drive Inspiron](http://www.cnet.com/laptops/dell-inspiron-n5110-15/4505-3121_7-35127205.html)
into a more immersive writing experience with templates and so on, but nothing in favor of my Samsung Chromebook. While the Dell laptop clearly has more
came close to the experience of Draft, which was exactly what I wanted to begin computing power, I preferred the Chromebook for a few reasons:
with. It's a wonder that more people don't know about Draft, but I guess that's
part of the magic. There's a real person, an innovative and driven hacker,
behind the product who might actually listen to what I have to say.
Now excuse me while I go waste more time scouring the web for more obscure but * **Lightweight**: its only 2.4 pounds. That feels like nothing compared to
brilliant apps. the 5.5 pound monstrosity that used to weigh down my backpack.
* **Battery life**: officially its 6.5 hours, but Ive seen up to 9 hours
before. Its very freeing to not need to plug in my laptop everywhere I go.
* **Size**: the screen is just 11.6” and its 0.7” thin. I honestly didnt
think Id prefer a smaller laptop, but the experience has been a lot better in
general.
* **Screen Resolution**: even though the screen is smaller, its still 1366x768
-- the same as my Dell laptop. Resolution is very important to me: higher
resolution means I can fit more information on the screen, and my young eyes
can handle the smaller text. Going back to my Dell feels like looking through a
magnifying glass now.
* **Trackpad**: I use an [Apple Magic
Trackpad](http://www.apple.com/magictrackpad/?) at work, which is heralded as
the best trackpad out there, and in my opinion the Samsung Chromebook has a
trackpad thats just as nice. Dont even get me started with how horrible the
Dell trackpad is; I had to disable it and use keyboard shortcuts for everything
instead.
* **Keyboard**: the Chromebook has a keyboard that closely resembles an Apple
keyboard, and its hard to describe exactly why, but the feedback just makes it
feel *nicer* to type on than the one on my Dell laptop. Also, the search key
that replaces the Caps Lock key is really useful.
* **Price**: all of this great hardware for just $249 seems unreal. Im sure
this is what converts many people, and its good to know I can do everything I
need to on a laptop thats under $300.
* **Perks**: as an aside, Google also gives you 100GB free Google Drive space
for 2 years and 12 free Gogo passes with the Chromebook, which definitely comes
in handy.
<div> <a href="/static/img/chromebook_keyboard.jpg"><img
src="/static/img/chromebook_keyboard_thumb.jpg" alt="Samsung Chromebook
keyboard up close" style="float: left;"></a> <a
href="/static/img/chromebook_trackpad.jpg"><img
src="/static/img/chromebook_trackpad_thumb.jpg" alt="Samsung Chromebook
trackpad up close" style="float: right;"></a> </div> <br>
While that all of that is nice, the Chromebook still only has 16GB internal
storage, no DVD drive, no ethernet port, and hardly any processing power. And I
still need to be able to code and write on my laptop and access specific
programs that only run on Linux or Windows machines. ChromeOS has a lot of
things built in to get around these limitations, but some things require a bit
of tweaking. If anyone has read my past posts, they know that I am obsessed
with configuring things. Here is what I came up with for everything I would
ever need to do on my Chromebook:
###Writing###
I spent a lot of time downloading
[various](https://chrome.google.com/webstore/detail/write-space/aimodnlfiikjjnmdchihablmkdeobhad)
[writing](https://chrome.google.com/webstore/detail/writer/pnengefjfhgcceajaepbjhanoojifmog)
[applications](https://chrome.google.com/webstore/detail/writebox/bbehjmjchoiaglkeboicbgkpfafcmhij)
from the Chrome Web Store, but nothing seemed to work as well and seemless as
the stock Google Drive documents application. You cant beat automatic saving
to the cloud with the ability to collaborate simultaneously with other people.
In order to make the experience more immersive put Chrome into fullscreen and
hide the controls by clicking the “View” menu and then selecting “Full Screen”.
Im currently in the Beta channel of ChromeOS, so you may need to switch to
that channel and enable “Immersive Mode” in `chrome://flags` to get it looking
like I have in the screenshot ([more
info](http://gigaom.com/2013/08/22/chrome-os-users-gain-immersive-mode-and-more-in-stable-channel-update/))
<a href="/static/img/fullscreen_gdocs.png"><img
src="/static/img/fullscreen_gdocs_thumb.png" alt="Demonstrating Google Docs in
fullscreen immersive mode"></a>
Another little-known feature of Google Docs is creating a new document based
off of a template. I made a couple templates that expand the page out to almost
100% and resemble the colors of the OSX IA Writer app: one in [Gentium
Basic](https://drive.google.com/previewtemplate?id=1N7kZhXsYJoVJpt4rE5q7Xhp92M4DPB_-u2dOSkEAeRY&mode=public)
and one in [Open
Sans](https://drive.google.com/previewtemplate?id=1aX8UcUXpbiZD1HuTIofb8ookw6TYykWi50k47BTX6yk&mode=public).
To create a new document based off of a template: have a document already open,
go to the “File” menu, “New…”, and select “From Template…”. Its kind of a
hassle though, so I often just stick to the default style. Its a sign that I
am procrastinating if Im trying to look for the “perfect template” to write in
anyways.
###Programming###
Ive gotten so used to [vim](http://www.vim.org/) in a Linux
terminal that I dont think I could ever use any other editor. There are a few
local offline code editors for Chrome like
[Text](https://chrome.google.com/webstore/detail/text/mmfbcljfglbokpmkimbfghdkjmjhdgbg)
and
[ShiftEdit](https://chrome.google.com/webstore/detail/shiftedit/lcgmndephhjcabhhjfcmncnhbmgbkpij)
which are nice if Im working on a Chrome extension and want to keep the files
locally so I can test them on my Chromebook. However, I still do most of my
coding remotely on a Linux machine.
ChromeOS provides a way, out of the box, to ssh into any computer through its
terminal called “crosh”. Access crosh by typing Ctrl+Alt+T. But, I actually
prefer
[SecureShell](https://chrome.google.com/webstore/detail/secure-shell/pnhechapfaindjhompbnflcldabbghjo)
as an ssh client since it has more customization and can be opened up in a
separate window.
Dont have a Linux computer to ssh into? [Digital
Ocean](https://www.digitalocean.com/) has servers starting at $5/month.
Cheapest and easiest offer Ive seen yet (no that's not a referral link, Im
being genuine about that).
For using Eclipse or any of those other Windows/Linux specific GUI programs
theres [Chrome Remote
Desktop](https://chrome.google.com/webstore/detail/chrome-remote-desktop/gbchcmhmhahfdphkhkmpfmihenigjmpp)
which is installed by default on Chromebooks. I havent had the need to try it
out yet, but its nice to have around for when I do.
The best thing about coding on a Linux box through a Chromebook is that I still
have all of the great chrome apps and extensions right at my fingertips.
Especially when some apps can be opened up in small panels in the corner of the
screen temporarily.
###Panels###
Chrome recently released a new concept for opening new windows
called “Panels”, and once I discovered them I couldnt get enough of them. The
new feature allows apps and extensions to open up small chrome windows in the
bottom right corner of the screen and then draw the users attention when they
have a new notification.
They are absolutely perfect for long-running applications that need to stick
around but not be in your way, like chat programs and music programs. When Im
fullscreen in some other chrome window, I can quickly click the panels icon
and the window will pop open above all of the other windows. I can then
interact with it and minimize it back into the dock out of my way.
<a href="/static/img/chrome_panel.png"><img
src="/static/img/chrome_panel_thumb.png" alt="Demonstrating chrome panels with
Panel View for Play Music open"></a>
In order to enable them I had to be on the Beta channel of the ChromeOS and
enable “Panels” in `chrome://flags` ([more
info](http://www.chromium.org/developers/design-documents/extensions/proposed-changes/apis-under-development/panels)).
Since panels is such a recent feature, its hard to find apps that are
utilizing panels. Here are some that I have found useful and are working for
me:
* [Panel View for Play
Music](https://chrome.google.com/webstore/detail/panel-view-for-play-music/dimpomefjdddhjmkjgjdokhidjkcmhhn)
*
[Hangouts](https://chrome.google.com/webstore/detail/hangouts/nckgahadagoaajjgafhacjanaoiihapd)
* [Panel View for Google
Keep](https://chrome.google.com/webstore/detail/panel-view-for-keep/jccocffecajimkdjgfpjhlpiimcnadhb)
* [Google Tasks
Panel](https://chrome.google.com/webstore/detail/improved-google-tasks-pan/kgnappcencbgllhghhhgjnfjanfijdpn/)
Im still lacking Facebook Messenger and Google Voice panel view apps, so I
might try my hand at creating one myself soon.
###Web Browsing###
And, of course, being a laptop dedicated to chrome, it
obviously has a great web browsing experience.
Pin certain websites or apps to the dash at the bottom of the screen for easy
access to favorite content. Once pinned, open them by pressing Alt+NUM, where
NUM is the icons position on the dash from the left.
The search key on the keyboard opens a panel from the bottom of the screen to
enter in a search. The results give preference towards apps in the Chrome Web
Store as well, so its sometimes more useful than the Omnibar Chrome users are
used to.
Tangentially, I have found [Gmail
Offline](https://chrome.google.com/webstore/detail/gmail-offline/ejidjjhkpiempkbhmpbfngldlkglhimk)
very useful for email. It has an uncluttered UI inspired by the Gmail mobile
app, and runs very smoothly.
Let me know if you have anything else to add, or even if you would like to
argue against why Chromebooks are the best laptops :).

View File

@ -233,10 +233,12 @@ div.pagination {
border: 1px solid #ddd; border: 1px solid #ddd;
background-color: #eef; background-color: #eef;
padding: 0 .2em; padding: 0 .2em;
font-size: small;
} }
.post pre code { .post pre code {
border: none; border: none;
padding: 0;
} }
/* terminal */ /* terminal */