Skip to content

Instantly share code, notes, and snippets.

View jamespo's full-sized avatar
🏠
Working from home

J.P jamespo

🏠
Working from home
View GitHub Profile
@jamespo
jamespo / selenium-user-agent.py
Created August 14, 2024 08:49
Setting a custom user agent in Python Selenium
#!/bin/env python
from selenium import webdriver
from selenium.webdriver.chrome.options import Options
user_agent='Fake Browser'
myoptions = Options()
myoptions.add_argument(argument=f'--user-agent={user_agent}')
driver = webdriver.Chrome(options=myoptions)
driver.get("https://www.google.com")
@jamespo
jamespo / ibroadcast-uploader.py
Created February 15, 2024 12:44
Patched version of ibroadcast-uploader.py that skips synology @eadir
#!/usr/bin/env python
import requests
import json
import glob
import os
import hashlib
import sys
import traceback
@jamespo
jamespo / docker-compose.yml
Created August 3, 2022 09:41
docker-compose file for change-detection including playwright
version: '2'
services:
changedetection:
image: ghcr.io/dgtlmoon/changedetection.io
container_name: changedetection
hostname: changedetection
volumes:
- changedetection-data:/datastore
environment:
@jamespo
jamespo / footssh.sh
Created April 24, 2022 13:04
Shell function & alias to stop foot terminal confusing ssh
footssh()
{
if [[ $TERM = "foot" ]]; then
TERM=linux ssh $@
else
ssh $@
fi
}
alias ssh=footssh
@jamespo
jamespo / hello_world.py
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
{
"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 07:50
zip2lha.sh - convert zip files (for WHDLOAD) into lha for retropie / amiberry
#!/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 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
jamespo / python-pipenv.spec
Created March 8, 2018 12:59
Modified spec file for pipenv package for Fedora 27
# 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
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));