Skip to content

Instantly share code, notes, and snippets.

Avatar
🏠
Working from home

J.P jamespo

🏠
Working from home
View GitHub Profile
@jamespo
jamespo / hello_world.py
Last active Dec 3, 2020
Alexa Flask Python Skill using flask-ask-sdk - modification of Amazon "Hello World" Example
View hello_world.py
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
# You'll need a TLS terminating proxy (apache,nginx) in front of this
# This is a simple Hello World Alexa Skill, built using
# the decorators approach in skill builder.
import logging
from flask import Flask
View config.json
{
"FAUXMO": {
"ip_address": "AUTO"
},
"PLUGINS": {
"SimpleHTTPPlugin": {
"DEVICES": [
{
"port": 12340,
"off_cmd": "http://192.168.1.107/admin/api.php?disable=600&auth=YOUR_AUTH_CODE",
@jamespo
jamespo / zip2lha.sh
Created May 3, 2020
zip2lha.sh - convert zip files (for WHDLOAD) into lha for retropie / amiberry
View zip2lha.sh
#!/bin/bash
# zip2lha.sh - convert zip files (for WHDLOAD) into lha for retropie / amiberry
# USAGE: zip2lha.sh zipfilename.zip
# or to do whole directory: find . -name '*.zip -exec zip2lha.sh {} \;
# set TMPDIR & DESTDIR in script
# REQUIREMENTS: unzip & jlha-utils (NOT lha package) on raspbian
# BE CAREFUL! This script removes contents of TMPDIR after each conversion
FN=$1
@jamespo
jamespo / ws.py
Created Mar 23, 2018
test websockets server in python3
View ws.py
#!/usr/bin/env python
# test websockets - requires python 3.6+ & sanic
# start server & hit http://localhost:8000/static/WebSockets.html
# Put ws://localhost:8000/feed as Target
from sanic import Sanic
app = Sanic()
@jamespo
jamespo / python-pipenv.spec
Created Mar 8, 2018
Modified spec file for pipenv package for Fedora 27
View python-pipenv.spec
# Created by pyp2rpm-3.2.2
%global pypi_name pipenv
Name: python-%{pypi_name}
Version: 11.1.3
Release: 1%{?dist}
Summary: Sacred Marriage of Pipfile, Pip, & Virtualenv
License: MIT
URL: https://github.com/kennethreitz/pipenv
View quicksynergy.patch
diff -r1.2 ./main.c
145a146,156
> /* support "-m" argument to start minimized */
> int c;
> while ((c = getopt (argc, argv, "m")) != -1)
> switch (c)
> {
> case 'm':
> /* minimize the main window */
> gtk_window_iconify(GTK_WINDOW(main_window));
View synclient-to-x.py
#!/usr/bin/env python
# synclient-to-x.py - export synclient -l output to
# x.org config file [c] jamespo [at] gmail [dot] com
# USAGE: synclient -l | ./synclient-to-x.py > 50-synaptics.conf
from __future__ import print_function
import fileinput
print("""
@jamespo
jamespo / smtpsend.py
Created Nov 11, 2013
A short mailx style script with smtp support
View smtpsend.py
#!/usr/bin/env python
# smtpsend.py - mailx style tool with SMTP support
import smtplib
from optparse import OptionParser
import sys
from email.mime.text import MIMEText
def send_mail():
@jamespo
jamespo / thinkpad-buffer-navigate.el
Created Nov 7, 2013
Make browser back and forward keys work in emacs for changing buffers
View thinkpad-buffer-navigate.el
;; make thinkpad browser keys navigate buffers
(setq w32-pass-multimedia-buttons-to-system nil)
(global-set-key (kbd "<browser-forward>") 'next-buffer)
(global-set-key (kbd "<browser-back>") 'previous-buffer)
@jamespo
jamespo / deflate.conf
Last active Dec 15, 2015
Ansible playbook to set up tt-rss on an Amazon EC2 instance
View deflate.conf
<Location />
# Insert filter
SetOutputFilter DEFLATE
# Don't compress images
SetEnvIfNoCase Request_URI \
\.(?:gif|jpe?g|png)$ no-gzip dont-vary
# Make sure proxies don't deliver the wrong content
Header append Vary User-Agent env=!dont-vary
You can’t perform that action at this time.