#256 colors in putty, tmux/screen and vim There is a detailed answer on stackoverflow. If you are looking for a short one, here it is.
-
putty
Set
Connection -> Data -> Terminal-type stringtoxterm-256color -
tmux
Add this line to ~/.tmux.conf
| #!/bin/bash | |
| line=$(tail -1 /var/log/myapp/myapp.uwsgi.log) | |
| substr='uWSGI listen queue of socket' | |
| if test "${line#*$substr}" != "$line" | |
| then | |
| #We're using upstart, could be easily adapted to fx systemd | |
| # Adding a log statement to keep track of when this happens. Remember to create the monitor dir | |
| /sbin/initctl restart myapp > /var/log/myapp/monitor/uwsgi-monitor.log 2>&1 | |
| echo "$(date) restarted myapp due to listen queue error" >> /var/log/myapp/monitor/uwsgi-monitor.log |
#256 colors in putty, tmux/screen and vim There is a detailed answer on stackoverflow. If you are looking for a short one, here it is.
putty
Set Connection -> Data -> Terminal-type string to xterm-256color
tmux
Add this line to ~/.tmux.conf
If tmux fails with an error terminal open failed: missing or unsuitable terminal: rxvt-unicode-256color
log in to your remote host and create .terminfo/r in your home directory:
mkdir .terminfo/r
copy terminal information file to remote machine:
scp /usr/share/terminfo/r/rxvt-unicode* remote.host:.terminfo/r/
| ''' | |
| PIL's Image.thumbnail() returns an image that fits inside of a given size (preserving aspect ratios) | |
| but the size of the actual image will vary and is certainly not guaranteed to be the requested size. | |
| This is often inconvenient since the size of the returned thumbnail cannot be predicted. The django-thumbs | |
| library solves this for square thumbnails by cropping the image to a square and then resizing it. However, | |
| this only works for exact squares. | |
| This function generalizes that approach to work for thumbnails of any aspect ratio. The returned thumbnail | |
| is always exactly the requested size, and edges (left/right or top/bottom) are cropped off to adjust to | |
| make sure the thumbnail will be the right size without distorting the image. |
| <dom-module id="nyaovim-app"> | |
| <template> | |
| <style> | |
| html,body { | |
| background: transparent; | |
| } | |
| @keyframes blink { | |
| 0% { |
| #!/usr/bin/env bash | |
| # Clear out all previous attempts | |
| rm -rf "/tmp/source-git/" | |
| # Get the dependencies for git, then get openssl | |
| sudo apt-get install build-essential fakeroot dpkg-dev -y | |
| sudo apt-get build-dep git -y | |
| sudo apt-get install libcurl4-openssl-dev -y | |
| mkdir -p "/tmp/source-git/" |
| from collections import OrderedDict | |
| # ... | |
| class OrderFormMixin(object): | |
| ''' | |
| To apply add to Meta 'order' iterable | |
| ''' | |
| def __init__(self, *args, **kwargs): | |
| super(OrderFormMixin, self).__init__(*args, **kwargs) |
Look at LSB init scripts for more information.
Copy to /etc/init.d:
# replace "$YOUR_SERVICE_NAME" with your service's name (whenever it's not enough obvious)| <%= form_for(@user) do |f| %> | |
| <% if @user.errors.any? %> | |
| <div id="error_explanation"> | |
| <h2><%= pluralize(@user.errors.count, "error") %> prohibited this user from being saved:</h2> | |
| <ul> | |
| <% @user.errors.full_messages.each do |msg| %> | |
| <li><%= msg %></li> | |
| <% end %> | |
| </ul> |