Skip to content

Instantly share code, notes, and snippets.

View jonnyhtw's full-sized avatar
💭
eating cheese

Jonny Williams jonnyhtw

💭
eating cheese
  • Wellington, New Zealand
  • 07:06 (UTC -12:00)
View GitHub Profile
@maciakl
maciakl / gist:3827188
Created October 3, 2012 14:24
Compiling Vim 7.3 from source with no root
#!/bin/bash
mkdir ~/local
mkdir ~/build
export TARGET_DIR="$HOME/local"
cd ~/build
hg clone http://hg.debian.org/hg/pkg-vim/vim
cd vim
@fperez
fperez / contour_overlap.py
Created March 9, 2011 20:23
Matplotlib contours with overlap control
"""Contours with overlap control.
This script generates widely spaced black contours, with a gray patch in a
subregion where more finely-spaced colored contours are visible. The gray
patch covers the black contours.
"""
import numpy as np
import matplotlib.mlab as mlab
from matplotlib.patches import Rectangle
@jaysonrowe
jaysonrowe / .muttrc
Created May 6, 2012 23:10
Mutt Configuration
# basic .muttrc for use with Gmail
# Change the following six lines to match your Gmail account details
set imap_user = "username@gmail.com"
set imap_pass = ""
set smtp_url = "smtp://username@smtp.gmail.com:587/"
set smtp_pass = ""
set from = "username@gmail.com"
set realname = "Firstname Lastname"
#
set imap_user = 'user@gmail.com'
set imap_pass = 'pass'
set spoolfile = imaps://imap.gmail.com:993/INBOX
set folder = imaps://imap.gmail.com:993
set record="imaps://imap.gmail.com/[Gmail]/Sent Mail"
set postponed=”imaps://imap.gmail.com/[Gmail]/Drafts”
set message_cachedir=”~/.mutt/cache/bodies”
set certificate_file=~/.mutt/certificates
set smtp_url = "smtp://user@smtp.gmail.com:587/"
@pelson
pelson / sorted.ipynb
Last active April 14, 2021 15:39
Sorting an Iris cube by coordinate.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@cpelley
cpelley / gist:6351152
Created August 27, 2013 08:40
Plotting wind vectors (wind speed and direction)
import numpy as np
import matplotlib.pyplot as plt
import cartopy.crs as ccrs
import iris
from iris.coord_systems import GeogCS
from iris.cube import Cube
""""Create "The Matrix" of binary numbers scrolling vertically in your terminal.
original code adapted from juancarlospaco:
- http://ubuntuforums.org/showpost.php?p=10306676
Inspired by the movie: The Matrix
- Corey Goldberg (2013)
Requires:
@TiddoLangerak
TiddoLangerak / getCurrentWindowCWD.sh
Last active February 19, 2022 08:07
Script to get the CWD of the current active window, with support for shells running tmux. This can be used to launch new terminals in the same cwd as the current one.
#!/bin/bash
# i3 thread: https://faq.i3wm.org/question/150/how-to-launch-a-terminal-from-here/?answer=152#post-id-152
# Inspired by https://gist.github.com/viking/5851049 but with support for tmux
CWD=''
# Get window ID
ID=$(xdpyinfo | grep focus | cut -f4 -d " ")
# Get PID of process whose window this is
@pelson
pelson / Handling ORCA data in Iris.ipynb
Created August 13, 2013 08:40
A very rough example of working with ORCA data in iris and cartopy.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@Benbb96
Benbb96 / color_contrast.py
Last active July 19, 2022 12:53
Original PHP script from this stackoverflow question : https://stackoverflow.com/a/42921358/8439435 then updated to Python and following the WCAG 2.0 - G18.
BLACK_COLOR = "#000000"
WHITE_COLOR = "#FFFFFF"
def get_contrast_color(background_color: str) -> str:
"""
Util function to determine what's the best color between black or white to choose for a text
depending on the background color given in parameter.
Based on algorythm from WCAG 2.0 explained here : https://www.w3.org/TR/WCAG20-TECHS/G18.html#G18-tests
:param background_color: the background color in HEX format (eg: #9D412B)