Skip to content

Instantly share code, notes, and snippets.

View VincentVetsch's full-sized avatar

Vincent Vetsch VincentVetsch

  • McGlenn Home Inspections, LLC
  • Norfolk, NE
View GitHub Profile
@VincentVetsch
VincentVetsch / regex_multiline.py
Created August 25, 2012 01:08 — forked from w3ddd/regex_multiline.py
Python: Multiline Expression Matching
#http://stackoverflow.com/questions/587345/python-regular-expression-matching-a-multiline-block-of-text
re.compile(r"^(.+)\n((?:\n.+)+)", re.MULTILINE)
@VincentVetsch
VincentVetsch / clients.md
Created August 20, 2012 15:28 — forked from defunkt/clients.md
A list of Gist clients.

Gist Clients

Want to create a Gist from your editor, the command line, or the Services menu? Here's how.

Editor Support

@VincentVetsch
VincentVetsch / peakdetect.py
Created August 13, 2012 14:23 — forked from sixtenbe/analytic_wfm.py
Python: Peak detection
import numpy as np
from math import pi, log
import pylab
from scipy import fft, ifft
from scipy.optimize import curve_fit
i = 10000
x = np.linspace(0, 3.5 * pi, i)
y = (0.3*np.sin(x) + np.sin(1.3 * x) + 0.9 * np.sin(4.2 * x) + 0.06 *
np.random.randn(i))
@VincentVetsch
VincentVetsch / test.py
Created August 13, 2012 14:21
Python: Authenticate
if data.startswith("hello secret", 0) :
if data == "hello secret lemmetalk\n":
s.send("client authenticated\n")
# store the fact that this client has been authenticated in another list
# which keeps track of authenticated clients
# define this list at the top near where you defined the list for select sockets
else:
s.send("client not authenticated\n")
s.close()
@VincentVetsch
VincentVetsch / gdocs_test.py
Created August 13, 2012 14:20
Python: Get Pass
#!/usr/bin/env python
import getpass
import gdata.docs
import gdata.docs.client
import gdata.docs.service
gclient = gdata.docs.client.DocsClient()
gclient.ClientLogin(raw_input("Username: "), getpass.getpass(), "")
@VincentVetsch
VincentVetsch / gist:3341184
Created August 13, 2012 14:20 — forked from mikeyk/gist:1329319
Python: Testing storage of millions of keys in Redis
#! /usr/bin/env python
import redis
import random
import pylibmc
import sys
r = redis.Redis(host = 'localhost', port = 6389)
mc = pylibmc.Client(['localhost:11222'])
@VincentVetsch
VincentVetsch / websocketserver.py
Created August 13, 2012 14:19 — forked from mumrah/websocketserver.py
Python: Simple WebSockets
import time
import struct
import socket
import hashlib
import sys
from select import select
import re
import logging
from threading import Thread
import signal
@VincentVetsch
VincentVetsch / ai-class.py
Created August 13, 2012 14:18
Python: Download lecture videos of AI-Xlass
#!/usr/bin/env python
# -*- coding: utf-8 -*-
__author__ = "Deepak.G.R."
__license__ = 'Public Domain'
"""
usage:
Go to command line and type
python ai-class.py "topic-name"
@VincentVetsch
VincentVetsch / gist:3341150
Created August 13, 2012 14:17 — forked from JeffreyWay/gist:1525217
Python: Instant Server for Current Directory
alias server='open http://localhost:8000 && python -m SimpleHTTPServer'
@VincentVetsch
VincentVetsch / tree.md
Created August 13, 2012 14:16 — forked from hrldcpr/tree.md
Python: One Line Tree

One-line Tree in Python

Using Python's built-in defaultdict we can easily define a tree data structure:

def tree(): return defaultdict(tree)

That's it!