Skip to content

Instantly share code, notes, and snippets.

@motleytech
motleytech / install.sh
Created June 9, 2016 23:28
standard install script
sudo apt-get install python-pip
sudo pip install virtualenv
virtualenv venv
source env.sh
pip install -r requirements.txt
@motleytech
motleytech / env.sh
Created June 9, 2016 23:27
standard env.sh file
source venv/bin/activate
@motleytech
motleytech / javascript range
Created May 24, 2016 20:54
javascript range
# from http://stackoverflow.com/questions/3895478/does-javascript-have-a-method-like-range-to-generate-an-array-based-on-suppl
Array.from(new Array(10), (x, i) => i)
@motleytech
motleytech / capture elevator music data
Created May 22, 2016 18:12
capturing elevator music udp mp3 data using python
# from the reddit post
# https://www.reddit.com/r/programming/comments/4kdmmb/reverse_engineering_a_mysterious_udp_stream_in_my/
import socket
import struct
s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM, socket.IPPROTO_UDP)
s.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1)
s.bind(('', 2046))
@motleytech
motleytech / rename.py
Created May 22, 2016 05:48
rename files python drag drop target
import os
import sys
from pprint import pprint as pp
inpFiles = sys.argv[1:]
replacements = [
('.', ' '),
]
@motleytech
motleytech / local smtp mail server in python
Created April 28, 2016 22:02
Running a local smtp mail server in Python
python -m smtpd -n -c DebuggingServer localhost:25
@motleytech
motleytech / autoreload for twisted reactor
Created April 22, 2016 20:16
Autoreload for twisted server
#
# usage:
#
# import autoreload
#
# def myMain():
# site = server.Site(root)
# reactor.listenTCP(8080, site)
# reactor.run()
#
WS_EX_TOOLWINDOW := 0x00000080
+MButton::WinSet, ExStyle, ^%WS_EX_TOOLWINDOW%, A
^MButton::WinSet, AlwaysOnTop, toggle, A
@motleytech
motleytech / pystarter.cson
Created April 15, 2016 01:59
python starter snippet for atom
'.source.python':
'scaffolding':
'prefix': 'sca'
'body': '''
"""
module for doing module stuff
"""
__author__ = 'Motleytech <https://github.com/motleytech>'
def main():
@motleytech
motleytech / .pylintrc
Created April 14, 2016 04:40
pylintrc
[MASTER]
# Specify a configuration file.
#rcfile=
# Python code to execute, usually for sys.path manipulation such as
# pygtk.require().
#init-hook=
# Add files or directories to the blacklist. They should be base names, not