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 -*- | |
# Refactored by Malcolm Jones to work with GTK+3 PyGobject( aka PyGI ). Mar 2016. | |
# Demo application showing how once can combine the python | |
# threading module with GObject signals to make a simple thread | |
# manager class which can be used to stop horrible blocking GUIs. | |
# | |
# (c) 2008, John Stowers <[email protected]> |
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 python2 | |
""" | |
Automate your browser via telnet. | |
Requirements: | |
* Firefox | |
* MozRepl add-on (https://addons.mozilla.org/en-US/firefox/addon/mozrepl/) | |
- activate the add-on (under Tools -> MozRepl, "Start" and "Activate on startup") | |
Documentation of gBrowser: |
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
# coding=utf-8 | |
import os | |
import socket | |
import threading | |
import time | |
import traceback | |
import requests | |
def make_path(*parts): |
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
from numpy import asarray, array, arange, append, angle, complex128, float64, floor | |
from numpy import nonzero, sign, mat, sin, cos, exp, zeros, log10, unique, fix, ceil | |
from numpy import ones, prod, pi, NaN, zeros_like, ravel, any, linspace, diff | |
from numpy.fft import fft, ifft | |
from scipy.signal import convolve, freqz, roots, zpk2tf, tf2zpk, remez, get_window | |
from scipy.interpolate import interp1d | |
from scipy.linalg import toeplitz, hankel | |
def find(condition): | |
""" |
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
from gi.repository import GLib, Gtk, GtkClutter, Clutter, Gdk, GdkPixbuf | |
import sys | |
from random import random | |
BROWSERS = 42 | |
class ClutterBrowser(Gtk.ApplicationWindow): |
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
###################################################################### | |
# CURRENT AWARE LOCAL DATETIME | |
###################################################################### | |
from datetime import datetime | |
from tzlocal import get_localzone | |
local_tz = get_localzone() | |
local_dt = datetime.now(local_tz) |
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
"""making a dataframe""" | |
df = pd.DataFrame([[1, 2], [3, 4]], columns=list('AB')) | |
"""quick way to create an interesting data frame to try things out""" | |
df = pd.DataFrame(np.random.randn(5, 4), columns=['a', 'b', 'c', 'd']) | |
"""convert a dictionary into a DataFrame""" | |
"""make the keys into columns""" | |
df = pd.DataFrame(dic, index=[0]) |
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 set_foregroundcolor(ax, color): | |
'''For the specified axes, sets the color of the frame, major ticks, | |
tick labels, axis labels, title and legend | |
''' | |
for tl in ax.get_xticklines() + ax.get_yticklines(): | |
tl.set_color(color) | |
for spine in ax.spines: | |
ax.spines[spine].set_edgecolor(color) | |
for tick in ax.xaxis.get_major_ticks(): | |
tick.label1.set_color(color) |