Skip to content

Instantly share code, notes, and snippets.

Working from home

J.P jamespo

Working from home
View GitHub Profile
jamespo /
Created June 21, 2012 10:35
Quick script to bring Redhat network interfaces up
cd /etc/sysconfig/network-scripts
for if in ifcfg-eth0*
if [[ ! $if =~ "backup" ]]; then
ifup ${if/ifcfg-}
echo $if
jamespo /
Created June 29, 2012 20:45
parse phpchain xml export to csv format for import by keepass 2
#!/usr/bin/env python
# -*- coding:utf-8 -*-
''' - parse phpchain XML export to CSV'''
import xml.etree.ElementTree as ET
import sys
def parse(file):
tree = ET.parse(file)
jamespo / deflate.conf
Last active December 15, 2015 01:09
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
jamespo / thinkpad-buffer-navigate.el
Created November 7, 2013 15:13
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 /
Created November 11, 2013 23:08
A short mailx style script with smtp support
#!/usr/bin/env python
# - mailx style tool with SMTP support
import smtplib
from optparse import OptionParser
import sys
from email.mime.text import MIMEText
def send_mail():
#!/usr/bin/env python
# - export synclient -l output to
# config file [c] jamespo [at] gmail [dot] com
# USAGE: synclient -l | ./ > 50-synaptics.conf
from __future__ import print_function
import fileinput
View quicksynergy.patch
diff -r1.2 ./main.c
> /* 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));
jamespo / python-pipenv.spec
Created March 8, 2018 12:59
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
jamespo /
Created March 23, 2018 15:27
test websockets server in python3
#!/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 /
Last active August 12, 2021 16:19
Alexa Flask Python Skill using flask-ask-sdk - modification of Amazon "Hello World" Example
#!/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