This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
# | |
# Copyright 2008-2014 Jose Fonseca | |
# | |
# This program is free software: you can redistribute it and/or modify it | |
# under the terms of the GNU Lesser General Public License as published | |
# by the Free Software Foundation, either version 3 of the License, or | |
# (at your option) any later version. | |
# | |
# This program is distributed in the hope that it will be useful, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/python2 | |
#! coding: utf-8 | |
class QuadTree(object): | |
"""An implementation of a quad-tree. | |
This QuadTree started life as a version of [1] but found a life of its own | |
when I realised it wasn't doing what I needed. It is intended for static | |
geometry, ie, items such as the landscape that don't move. | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
typedef struct point{ | |
double x; | |
double y; | |
} point; | |
double get_distance(const point a, const point b) | |
{ | |
double xdiff = a.x - b.x; | |
double ydiff = a.y - b.y; | |
return xdiff*xdiff + ydiff*ydiff; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/python | |
import matplotlib as mpl | |
from mpl_toolkits.mplot3d import Axes3D | |
import numpy as np | |
import matplotlib.pyplot as plt | |
import sys | |
#plt.rc('text', usetex=True) | |
#plt.rc('font', **{'family':'monospace','monospace':['Ubuntu Mono'], 'size':16}) | |
#mpl.rcParams['legend.fontsize'] = 10 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
"3.8.2 (created: 2014/02/13 23:52:43) | |
map <C-c> :stop<Return> | |
map <lt> <C-6> | |
map p <C-z> | |
map v <C-v> | |
map <C-s> :stop<Return> | |
nmap <F5> :set<Space>gui=navigation<Return> | |
nmap <C-F5> :set<Space>gui=nonavigation<Return> | |
noremap j 5j |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
\documentclass[$if(fontsize)$$fontsize$,$endif$$if(lang)$$lang$,$endif$$if(papersize)$$papersize$,$endif$]{$documentclass$} | |
\usepackage{geometry} % 設定邊界 | |
\geometry{ | |
top=1in, | |
inner=1in, | |
outer=1in, | |
bottom=1in, | |
headheight=3ex, | |
headsep=2ex | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// ==UserScript== | |
// @name 驱逐私信,恢复豆邮 | |
// @namespace http://fanfou.com/lzgxd | |
// @description 将“私信”恢复成“豆邮” | |
// @include http://*.douban.com/* | |
// @version 0.1 | |
// @grant none | |
// ==/UserScript== | |
// via http://stackoverflow.com/a/1512889 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
song=$(echo -n `mocp -Q %song 2> /dev/null`) | |
artist=$(echo -n `mocp -Q %artist 2> /dev/null`) | |
if [[ "$song" != "" ]] | |
then | |
if [[ "$artist" != "" ]] | |
then | |
echo -n "\${color white} Now Playing: \${color green} $song - $artist" | |
else | |
echo -n "\${color white} Now Playing: \${color green} $song" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
from=$1 | |
shift | |
notify-send -i "/home/orz/.scripts/notify.png" -- "New Message" "From: $from \n$*" 2 > /dev/null | |
aplay -q "/home/orz/.scripts/message.wav" & |
OlderNewer