Run the following from a terminal to tighten down the security on your MySQL installation:
# mysql_secure_installation
Run the following from a terminal to tighten down the security on your MySQL installation:
# mysql_secure_installation
Open /boot/config.txt and update the following lines:
# uncomment to force a console size. By default it will be display's size minus
# overscan.
framebuffer_width=960
framebuffer_height=540
The original values (and the values derived from a high resolution screen) are much larger which results in tiny text on a high resolution display.
# apt-get install unattended-upgrades
# dpkg-reconfigure --priority=low unattended-upgrades
More at https://help.ubuntu.com/community/AutomaticSecurityUpdates
I needed to create a slew of objects for a project I was working on. Lots of tedious and error prone work. But wait, I'm using a computer. Automation to the rescue!
I wrote my script by first importing what I needed from Django (User and the Appointment model for the objects I was going to be creating). Then, I wrote what needed to be created enclosed in a for loop. To run the script, I jumped into Django's shell and ran the execfile()
command.
from django.contrib.auth.models import User
from app.models import Appointment
user_ids = [7, 8, 9, 10, 11, 12]
for i, user_id in enumerate(user_ids, start=1):
Appointment.objects.create(user=User.objects.get(id=user_id),
title="Test appointment.",
date="2015-12-01",
timeslot=i,
doctornotes="Sample doctors notes.")
./manage.py shell
>>> execfile('app/scripts/create_appointments.py')
Profit!
Static files for an app follow the following directory structure my_app/static/my_app and are picked up by ./manage.py collectstatic
when ready to deploy. If you're wanting to use static files that span multiple apps, update your settings.py to include the following:
STATICFILES_DIRS = (
os.path.join(BASE_DIR, "project_static"),
)
Temping it as it is, STATICFILES_DIRS cannot contain the location of STATIC_ROOT. Manually placing your static files where the collectstatic management command dumps its static files does not work nor does setting "project wide" static files into the same directory work, thus the separate "project_static" directory. Dropping files in here will allow them to be accessable via {% static 'file' %}
.
Source: https://docs.djangoproject.com/en/1.8/howto/static-files/
curl -su 'user' <url>
Source: https://stackoverflow.com/questions/9778670/curl-to-prompt-a-user-name-and-password
Streaming over-the-air TV in VLC, I noticed that some channels have heavy interlacing on the video with motion present. To resolve, I enabled deinterlacing with mode "Yadif" ("Yadif (2x)" consumed too much CPU). Yadif consumes about 60-75% CPU cycles.
Example of how deinterlacing improves video quality:
https://en.wikipedia.org/wiki/Interlaced_video#/media/File:Deinterlaced_vs_interlaced_image.gif
When setting up the SSL certificate for workingninja.com, I made a mistake in my VirtualHosts configuration file that handled the redirect of the non-SSL site to the SSL site. The mistakes was simple: I forgot a trailing slash on the receiving end of the redirect. Without the trailing slash on the receiving end, http://workingninja.com/blog was redirecting to https://workingninja.comblog. The correct configuration (with trailing slash):
Redirect permanent / https://workingninja.com/
Because 301 redirects are cached by the browser, whenever I tried to hit workingninja.com/blog I would end up with my browser trying to go to workingninja.comblog. To fix this, I opened up "Web developer tools" and made sure that the option to "Disable Cache" was selected. This fixed the redirect issue until I closed out the Web developer tools pane.
The final solution was to dump my cache for the browser entirely. I was hoping for a solution with a bit more finesse but a cache flush every once and a while isn't too bad of a thing to do =)
$( document ).ready(function() { });
is jQuery for:
document.addEventListener("DOMContentLoaded", function(event) { });
I do a lot of code from the command line. Here's how I have Vim tuned for use with Python.
~/.vimrc
syntax on
filetype indent plugin on
set tabstop=8
set expandtab
set shiftwidth=4
set softtabstop=4