Skip to content

Instantly share code, notes, and snippets.

# If you change this file, run 'update-grub' afterwards to update
# /boot/grub/grub.cfg.
# For full documentation of the options in this file, see:
# info -f grub -n 'Simple configuration'
GRUB_DEFAULT=0
GRUB_TIMEOUT=5
GRUB_DISTRIBUTOR=`lsb_release -i -s 2> /dev/null || echo Debian`
GRUB_CMDLINE_LINUX_DEFAULT="quiet"
GRUB_CMDLINE_LINUX="i915.i915_enable_rc6=1 pcie_aspm=force acpi_backlight=vendor"
@fmayer
fmayer / gist:3176117
Created July 25, 2012 13:10
Quick guide to Spectrogram objects
In [1]: import os
In [2]: from sunpy.spectra.sources.callisto import CallistoSpectrogram
In [3]: ls
BIR_20110922_050000_01.fit BIR_20110922_134459_01.fit
BIR_20110922_051500_01.fit BIR_20110922_135959_01.fit
BIR_20110922_053000_01.fit BIR_20110922_141459_01.fit
BIR_20110922_054500_01.fit BIR_20110922_142959_01.fit
BIR_20110922_060000_01.fit BIR_20110922_144459_01.fit
import sys
import random
def random_graph(num_nodes, num_edges, min_weight, max_weight):
edges = {}
rnodes = range(num_nodes)
random.shuffle(rnodes)
if num_edges < num_nodes - 1:
raise ValueError("Non connected graph.")
for n in xrange(num_nodes - 1):
>>> def a():
b = yield
print b
>>> x = a()
>>> x.next()
>>> x.send('Hello!')
Hello!
def itror(a, b):
a = iter(a)
b = iter(b)
try:
first = a.next()
except StopIteration:
for x in b:
yield x
else:
yield first
#!/usr/bin/env python
# Copyright (c) 2012 Florian Mayer <florian.mayer@bitsrc.org>
#
# Permission to use, copy, modify, and/or distribute this software for any
# purpose with or without fee is hereby granted, provided that the above
# copyright notice and this permission notice appear in all copies.
#
# THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
# WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
Downloading/unpacking pytest
Running setup.py egg_info for package pytest
Downloading/unpacking numpy
Running setup.py egg_info for package numpy
Running from numpy source directory./bin/sh: svnversion: not found
non-existing path in 'numpy/distutils': 'site.cfg'
F2PY Version 2
blas_opt_info:
blas_mkl_info:
libraries mkl,vml,guide not found in /home/segfaulthunter/te/lib
def doc(docstring):
def deco(fn):
fn.__doc__ = docstring
return fn
return deco
# Copyright (c) 2011, Florian Mayer <flormayer@aim.com>
#
# Permission to use, copy, modify, and/or distribute this software for any
# purpose with or without fee is hereby granted, provided that the above
# copyright notice and this permission notice appear in all copies.
#
# THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
# WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
# MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
# ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
(defn divides? [n x] (zero? (rem x n)))
(defn any-divides? [ns x] (some #(divides? % x) ns))
(defn get-divided [ns lst] (filter (partial any-divides? ns) lst))
(def sum (partial apply +))
(println (sum (get-divided [3 5] (range 1000))))