Skip to content

Instantly share code, notes, and snippets.

John Stowers nzjrs

Block or report user

Report or block nzjrs

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@bossjones
bossjones / FooThread.py
Last active May 27, 2018
Updated PyGtk threading example, originally made by John Stowers at https://gist.github.com/nzjrs/51686 ... This is a more modern example using PyGObject (aka PyGI)... essentially the modern Python Bindings for GLib/GObject/GIO/GTK+. Includes Gtk3 support.
View FooThread.py
#!/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 <john.stowers@gmail.com>
@jabbalaci
jabbalaci / firefox.py
Created Jan 5, 2015
open tabs with Firefox in the background (as requested in http://redd.it/2rd2g9)
View firefox.py
#!/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:
@andreif
andreif / ftpserver.py
Last active Sep 1, 2018 — forked from scturtle/ftpserver.py
Simple FTP server in Python 2
View ftpserver.py
# coding=utf-8
import os
import socket
import threading
import time
import traceback
import requests
def make_path(*parts):
@endolith
endolith / designtools.py
Last active Dec 18, 2015
GPL-licensed SciPy signal processing tools by Kittipong Piyawanno
View designtools.py
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):
"""
@sahib
sahib / clutter.py
Created May 4, 2013
Playing around with Python/Clutter/Gtk. Simple Swipe Effect.
View clutter.py
from gi.repository import GLib, Gtk, GtkClutter, Clutter, Gdk, GdkPixbuf
import sys
from random import random
BROWSERS = 42
class ClutterBrowser(Gtk.ApplicationWindow):
@ju-popov
ju-popov / timestamp.py
Last active Jan 22, 2018
Python DateTime / Timestamp Convertion
View timestamp.py
######################################################################
# CURRENT AWARE LOCAL DATETIME
######################################################################
from datetime import datetime
from tzlocal import get_localzone
local_tz = get_localzone()
local_dt = datetime.now(local_tz)
@why-not
why-not / gist:4582705
Last active May 28, 2019
Pandas recipe. I find pandas indexing counter intuitive, perhaps my intuitions were shaped by many years in the imperative world. I am collecting some recipes to do things quickly in pandas & to jog my memory.
View gist:4582705
"""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])
@jasonmc
jasonmc / gist:1160951
Created Aug 21, 2011
Setting colors in matplotlib easily (can do white-on-black)
View gist:1160951
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)
You can’t perform that action at this time.