Hugo Pagination Partial for Bootstrap4
🖊️ Austin Riba ⌚ 🔖 code 💬 0
Hugo’s internal template for pagination claims it works with Bootstrap styles. That may have been the case for Bootstrap3, but now that 4 is out, it requires a few more classes.
Imaging the Space Tesla
🖊️ Austin Riba ⌚ 🔖 astronomy 💬 0
Back in the beginning of February SpaceX launched their Falcon Heavy rocket to much fanfare and excitement. This test launch also had a test payload: Starman, a mannequin in a prototype SpaceX space suit behind the wheel of a cherry red Tesla Roadster. Spaceman was successfully inserted into a heliocentric orbit and there he’ll remain for millions of years.
For a few days Spaceman was close enough to earth to be visible by professional grade telescopes. As an employee of a company that builds and deploys a network of robotic telescopes I had to see if I could get an image of this guy.
Dr. Tim lister and I both set up observations, but of course Tim’s (who studies near earth objects) came back in better quality. I did some stacking and scaling and ended up with a .gif. Ladies and gentlemen, I present to you Starman in 9 parts:
The image consists of 9x32 second exposures on one of our 1 Meter telescopes in Cerro Tololo, Chile. The images were captured around 2018-02-09 08:43 UTC.
See if you can find the faintly visible galaxy in the top left corner of the image.
Godspeed, Starman.
Line by Line Simple but Usable VIM Config
🖊️ Austin Riba ⌚ 🔖 code 💬 0
VIM is a great editor, but it’s defaults are a little lacking. Fortunately
it’s also extremely configurable. This leads many people (myself included),
to scour the internet for lines of internet wisdom to copy in paste into
their .vimrc
files until they get something that works for them. Before
you know it you have 300 lines of unintelligible gobblegook. In this post,
(which I’ve started writing in vanilla vim) I’m going to go line by line
through individual config items to construct a simple but usable .vimrc
without too much magic or frills.
GNOME Notifications for Remote Weechat
🖊️ Austin Riba ⌚ 🔖 code 💬 0
I ❤ Weechat. It’s my IRC client of choice. But I also use it for gtalk and Slack. All my conversations in one convenient interface. Even better, I run it in a remote tmux session so I can pick up wherever I left off from anywhere.
The only annoying thing about this setup was the lack of real notifications for private messages or mentions. So I wrote Weelisten.
Weelisten is a small python script that leverages Weechat’s relay protocol, python 3 asyncio and libnotify so I can get awesome native notifications on my desktop.
Sounds useful? Get it on Github
Turn Off Mobile Data
🖊️ Austin Riba ⌚ 🔖 other 💬 0
There’s a lot of talk on the web about the dangers of always on technology and addictive social media. I’m here to give you a life pro tip.
Turn off mobile data.
You’ll have wireless in most places anyway, but not being connected outside of wifi means less distractions on walks, at dinner, or in the movies. You can still turn on data if you really need it, but the barrier is high enough that you’re unlikely to use it to get a quick hit of reddit.
I started doing this when AT&T made me give up my trusty nokia dumb phone and I got a smart phone. Seems to work great.
Too Far, Too Fast: Backpacking the Manzana Hurricane Deck Loop
🖊️ Austin Riba ⌚ 🔖 Backpacking 💬 0
Labor day weekend, the official start of summer. Time to bust out that barbecue, unfurl that tent! While many people in America are celebrating the beginning of the outdoor season, some of us are squeezing in our last few adventures before the end of it. While not technically closed during the summer the Los Padres National Forest back country it not a place you generally want to be in the middle of July. Water is scarce to non-existent, temperatures hang around the triple digits and as someone once said: “the ground itself becomes a furnace”.
So when the forecast for the weekend showed mid 70s temperatures and even some cloud cover, Andrea and I took the opportunity to head out to the San Rafael Wilderness to give a few nights backpacking and a walk on the infamous Hurricane Deck a shot.
Throttling Specific Actions in Django Rest Framework Viewsets
🖊️ Austin Riba ⌚ 🔖 code 💬 5
If you are using rate limiting with Django Rest Framework you probably already know that
it provides some pretty simple methods for setting global rate limits
using DEFAULT_THROTTLE_RATES.
You can also set rate limits for specific views using the throttle_classes
property on class-based views
or the @throttle_classes
decorator for function based views.
What if you are using ViewSets
but want different throttling rules to apply to different actions? Unfortunately
DRF provides no official method of doing this. Luckily we can accomplish this functionality without too much fuss using get_throttles()
.
Dockerize! Lest you forget
🖊️ Austin Riba ⌚ 🔖 code 💬 0
I host quite a few sideprojects on my VPS. They range from static Jekyll sites (like this one) to large web applications. There’s even some wordpress hiding in a corner, disgraced and neglected.
Despite the fact that none of these sites are actually useful for anything, they still need some poor bastard to keep then running. Over the years I’ve collected quite the assortment of nginx, uwsgi, php, apache, supervisor, and other configs. All of them written at various levels of understanding, none of them tracked anywhere, all of them confusing and terrible.
Preserve GET parameters using django-bootstrap3 pagination
🖊️ Austin Riba ⌚ 🔖 code 💬 1
This one got me for a bit. If you are using django-bootstrap3 and also want to use it’s handy bootstrap_pagination template tag for generating pagination links, you may be in for an unplesant surprise if your view uses any GET parameters. While the django-bootstrap-pagination project handles this by default, django-bootstrap3 will not persist GET paramters between pages.
The key to using the bootstrap_pagination
tag is the extra
argument, which takes a string and appends it to each page. If you
have the request_context
context processor installed, you can pass in this string using the QueryDict urlencode() method. For example:
{% bootstrap_pagination page_obj extra=request.GET.urlencode %}
Voila. Pagination in django with bootstrap working as it should.
Santa Barbara Solar System Ride
🖊️ Austin Riba ⌚ 🔖 astronomy cycling 💬 0
LCOGT has participated in this year’s Cyclemaynia event in the best way we know how: by geeking out over both cycling and astronomy at the same time.
I thought it would be neat to do a scale model of the solar system that people could ride in order to experience in order to gain a deeper appreciation of how vast the solar system really is.