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
function [maxtab, mintab]=peakdet(v, delta, x) | |
%PEAKDET Detect peaks in a vector | |
% [MAXTAB, MINTAB] = PEAKDET(V, DELTA) finds the local | |
% maxima and minima ("peaks") in the vector V. | |
% MAXTAB and MINTAB consists of two columns. Column 1 | |
% contains indices in V, and column 2 the found values. | |
% | |
% With [MAXTAB, MINTAB] = PEAKDET(V, DELTA, X) the indices | |
% in MAXTAB and MINTAB are replaced with the corresponding | |
% X-values. |
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 | |
# -*- coding: UTF-8 -*- | |
# Gnome Keyring in Python | |
# Shows how to store credentials of type NETWORK_PASSWORD using python. | |
# Found on <http://www.rittau.org/blog/20070726-01> | |
# More on the GNOME Keyring: <http://live.gnome.org/GnomeKeyring> | |
# alternatively have a look at the new universal and actively developed Python Keyring: | |
# on <http://pypi.python.org/pypi/keyring> and <http://home.python-keyring.org/> |
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
/* | |
* object.watch polyfill | |
* | |
* 2012-04-03 | |
* | |
* By Eli Grey, http://eligrey.com | |
* Public Domain. | |
* NO WARRANTY EXPRESSED OR IMPLIED. USE AT YOUR OWN RISK. | |
*/ |
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 | |
""" | |
PIP can stand for PIP Installs packages Programmatically, too! | |
(and here's how) | |
Requires: | |
* Python 2.6 or higher (for print-as-a-function) | |
* PIP 0.8.2 | |
""" |
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 | |
# Copyright (C) 2016 Sixten Bergman | |
# License WTFPL | |
# | |
# This program is free software. It comes without any warranty, to the extent | |
# permitted by applicable law. | |
# You can redistribute it and/or modify it under the terms of the Do What The | |
# Fuck You Want To Public License, Version 2, as published by Sam Hocevar. See |
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
import itertools | |
import _winreg as winreg | |
def enumerate_serial_ports(): | |
path = 'HARDWARE\\DEVICEMAP\\SERIALCOMM' | |
key = winreg.OpenKey(winreg.HKEY_LOCAL_MACHINE, path) | |
ports = [] | |
for i in itertools.count(): | |
try: | |
val = winreg.EnumValue(key, i) |
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 | |
import socket | |
import os | |
import struct | |
if getattr(socket, "NETLINK_CONNECTOR", None) is None: | |
socket.NETLINK_CONNECTOR = 11 | |
CN_IDX_PROC = 1 |
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
/* | |
=============================================================================== | |
A C++ port of a speed-improved simplex noise algorithm for 2D in Java. | |
Based on example code by Stefan Gustavson (stegu@itn.liu.se). | |
Optimisations by Peter Eastman (peastman@drizzle.stanford.edu). | |
Better rank ordering method by Stefan Gustavson in 2012. | |
C++ port and minor type and algorithm changes by Josh Koch (jdk1337@gmail.com). | |
This could be speeded up even further, but it's useful as it is. |
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
import com.handmark.pulltorefresh.library.PullToRefreshListView; | |
import android.os.Bundle; | |
import android.support.v4.app.ListFragment; | |
import android.view.LayoutInflater; | |
import android.view.View; | |
import android.view.ViewGroup; | |
import android.widget.ListView; | |
public class PullToRefreshListFragment extends ListFragment { |
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
def draw_rounded(cr, area, radius): | |
""" draws rectangles with rounded (circular arc) corners """ | |
from math import pi | |
a,b,c,d=area | |
cr.arc(a + radius, c + radius, radius, 2*(pi/2), 3*(pi/2)) | |
cr.arc(b - radius, c + radius, radius, 3*(pi/2), 4*(pi/2)) | |
cr.arc(b - radius, d - radius, radius, 0*(pi/2), 1*(pi/2)) # ;o) | |
cr.arc(a + radius, d - radius, radius, 1*(pi/2), 2*(pi/2)) | |
cr.close_path() | |
cr.stroke() |
OlderNewer